d3 / d3-geo-polygon

Clipping and geometric operations for spherical polygons.
https://observablehq.com/collection/@d3/d3-geo-polygon
Other
107 stars 22 forks source link

South aspect of Lee’s conformal projection in a tetrahedron is all black #28

Closed espinielli closed 5 years ago

espinielli commented 5 years ago

South aspect of Lee’s conformal projection in a tetrahedron shows all black.

From the tweet exchange @Fil has verified that

it doesn't happen with d3-geo-polygon@1.7 but with d3-geo-polygon@1.8

Fil commented 5 years ago

Ref: https://observablehq.com/@fil/lee-projection (which I momentarily “fixed” by going back to d3-geo-polygon@1.7).

Fil commented 5 years ago

the bad commit is eb1e6635c35c3d21eb32c292115922205e89d153 (of course)

Fil commented 5 years ago

There is this quick test in https://github.com/d3/d3-geo-polygon/blob/master/src/intersect.js#L19 : two arcs of angles a.l and b.l can not intersect if the distance between start (or end) of the first and the start (or end) of the second make an angle > a.l + b.l.

I optimized it with the acos of the angles and forgot that, if A+B > pi, the cosine increases again. Fix and test incoming.

espinielli commented 5 years ago

you are a wizard! well done and thanks