@@ -20,7 +20,7 @@ function d3_geo_projectionMutator(projectAt) {
2020 δγ = 0 ,
2121 δx = x ,
2222 δy = y ,
23- clip = d3_geo_cut ,
23+ clip = d3_geo_cut , // TODO rename: it's often cutting, not clipping!
2424 clipAngle = null ;
2525
2626 function projection ( coordinates ) {
@@ -33,7 +33,8 @@ function d3_geo_projectionMutator(projectAt) {
3333 return [ coordinates [ 0 ] * d3_degrees , coordinates [ 1 ] * d3_degrees ] ;
3434 }
3535
36- // TODO extract
36+ // TODO extract (extract what?)
37+ // TODO rename: this is not just resampling, it also projects and transforms!
3738 var resample = d3_geo_type ( {
3839 Point : function ( o ) {
3940 o . coordinates = resamplePoint ( o . coordinates ) ;
@@ -69,15 +70,18 @@ function d3_geo_projectionMutator(projectAt) {
6970 return projection ;
7071 } ;
7172
72- // TODO rename: this is not just rotation; it also converts degrees to radians
73+ // TODO rename: this is not just rotation, it also converts to radians!
74+ // TODO don't create new objects for rotation? (since clipping does the same?)
7375 var rotation = d3_geo_type ( {
7476 point : function ( coordinates ) {
7577 return rotate ( coordinates [ 0 ] * d3_radians , coordinates [ 1 ] * d3_radians ) ;
7678 } ,
7779 Sphere : d3_identity
7880 } ) ;
7981
80- // TODO remove redundant code with p(coordinates)
82+ // TODO rename: this is not just projection, it also transforms!
83+ // TODO rename: how does projectPoint disambiguate this method from project?
84+ // TODO remove redundant code with p(coordinates)?
8185 function projectPoint ( λ , φ ) {
8286 var point = project ( λ , φ ) ;
8387 return [ point [ 0 ] * k + δx , δy - point [ 1 ] * k ] ;
@@ -125,6 +129,7 @@ function d3_geo_projectionMutator(projectAt) {
125129 return projection ;
126130 }
127131
132+ // TODO move these vars up to the top?
128133 // Resampling.
129134 var λ00 ,
130135 φ00 ,
@@ -136,10 +141,12 @@ function d3_geo_projectionMutator(projectAt) {
136141 δ2 = .5 , // (precision in px)².
137142 maxDepth = 16 ;
138143
144+ // TODO rename: this is not just resampling, it also projects and transforms!
139145 function resamplePoint ( point ) {
140146 return projectPoint ( point [ 0 ] , point [ 1 ] ) ;
141147 }
142148
149+ // TODO rename: this is not just resampling, it also projects and transforms!
143150 function resampleLine ( coordinates ) {
144151 if ( ! ( n = coordinates . length ) ) return coordinates ;
145152 var n ,
@@ -164,6 +171,7 @@ function d3_geo_projectionMutator(projectAt) {
164171 return line ;
165172 }
166173
174+ // TODO rename: this is not just resampling, it also projects and transforms!
167175 function resamplePolygon ( coordinates ) {
168176 var n = coordinates . length ,
169177 i = - 1 ,
@@ -178,6 +186,7 @@ function d3_geo_projectionMutator(projectAt) {
178186 return polygon ;
179187 }
180188
189+ // TODO rename: this is not just resampling, it also projects and transforms!
181190 function resampleLineTo ( x0 , y0 , λ0 , sinφ0 , cosφ0 , x1 , y1 , λ1 , sinφ1 , cosφ1 , depth , line ) {
182191 var dx = x1 - x0 ,
183192 dy = y1 - y0 ,
0 commit comments