diff --git a/src/clip/circle.js b/src/clip/circle.js index 30dcf44..de11999 100644 --- a/src/clip/circle.js +++ b/src/clip/circle.js @@ -6,7 +6,7 @@ import clip from "./index.js"; export default function(radius) { var cr = cos(radius), - delta = 6 * radians, + delta = 2 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case diff --git a/test/projection/clipcircle-test.js b/test/projection/clipcircle-test.js index 33dfcca..5c2b216 100644 --- a/test/projection/clipcircle-test.js +++ b/test/projection/clipcircle-test.js @@ -8,5 +8,5 @@ it("projection.clipAngle() deals with degenerate polygons", () => { coordinates: [ [[-120, -30],[0, -30],[0, -90],[0, -30],[120, -30],[-120, -30]] ] }; const projection = geoAzimuthalEqualArea().translate([0.5, 0.5]).rotate([0, -90, 0]).clipAngle(170); - assert.strictEqual(geoPath(projection)(polygon).replace(/\.\d+/g,""), 'M0,249L0,238L0,216L21,219L45,219L71,215L98,207L127,193L141,184L155,173L168,161L181,148L192,133L202,117L211,100L218,83L224,65L228,48L230,30L231,13L229,-17L222,-45L212,-70L200,-90L187,-107L179,-127L167,-147L151,-168L130,-188L104,-206L89,-213L73,-220L55,-225L37,-229L19,-232L0,-233L-18,-232L-36,-229L-54,-225L-72,-220L-88,-213L-103,-206L-129,-188L-150,-168L-166,-147L-178,-127L-186,-107L-186,-107L-199,-90L-211,-70L-221,-45L-228,-17L-230,13L-229,30L-227,48L-223,65L-217,83L-210,100L-201,117L-191,133L-180,148L-167,161L-154,173L-140,184L-126,193L-97,207L-70,215L-44,219L-20,219L0,216L0,238L0,249L0,249L-25,247L-51,243L-76,236L-100,227L-123,215L-145,201L-165,185L-184,166L-200,146L-214,124L-226,101L-235,77L-242,52L-246,26L-248,0L-246,-25L-242,-51L-235,-76L-226,-100L-214,-123L-200,-145L-184,-165L-165,-184L-145,-200L-123,-214L-100,-226L-76,-235L-51,-242L-25,-246L0,-248L26,-246L52,-242L77,-235L101,-226L124,-214L146,-200L166,-184L185,-165L201,-145L215,-123L227,-100L236,-76L243,-51L247,-25L249,0L247,26L243,52L236,77L227,101L215,124L201,146L185,166L166,185L146,201L124,215L101,227L77,236L52,243L26,247Z'); + assert.strictEqual(geoPath(projection)(polygon).replace(/\.\d+/g,""), 'M0,249L0,238L0,216L21,219L45,219L71,215L98,207L127,193L141,184L155,173L168,161L181,148L192,133L202,117L211,100L218,83L224,65L228,48L230,30L231,13L229,-17L222,-45L212,-70L200,-90L187,-107L179,-127L167,-147L151,-168L130,-188L104,-206L89,-213L73,-220L55,-225L37,-229L19,-232L0,-233L-18,-232L-36,-229L-54,-225L-72,-220L-88,-213L-103,-206L-129,-188L-150,-168L-166,-147L-178,-127L-186,-107L-186,-107L-199,-90L-211,-70L-221,-45L-228,-17L-230,13L-229,30L-227,48L-223,65L-217,83L-210,100L-201,117L-191,133L-180,148L-167,161L-154,173L-140,184L-126,193L-97,207L-70,215L-44,219L-20,219L0,216L0,238L0,249L0,249L-8,248L-16,248L-25,247L-34,246L-42,245L-51,243L-59,241L-68,239L-76,236L-84,234L-92,230L-100,227L-108,223L-116,219L-123,215L-131,211L-138,206L-145,201L-152,196L-159,190L-165,185L-172,179L-178,173L-184,166L-189,160L-195,153L-200,146L-205,139L-210,132L-214,124L-218,117L-222,109L-226,101L-229,93L-233,85L-235,77L-238,69L-240,60L-242,52L-244,43L-245,35L-246,26L-247,17L-247,9L-248,0L-247,-8L-247,-16L-246,-25L-245,-34L-244,-42L-242,-51L-240,-59L-238,-68L-235,-76L-233,-84L-229,-92L-226,-100L-222,-108L-218,-116L-214,-123L-210,-131L-205,-138L-200,-145L-195,-152L-189,-159L-184,-165L-178,-172L-172,-178L-165,-184L-159,-189L-152,-195L-145,-200L-138,-205L-131,-210L-123,-214L-116,-218L-108,-222L-100,-226L-92,-229L-84,-233L-76,-235L-68,-238L-59,-240L-51,-242L-42,-244L-34,-245L-25,-246L-16,-247L-8,-247L0,-248L9,-247L17,-247L26,-246L35,-245L43,-244L52,-242L60,-240L69,-238L77,-235L85,-233L93,-229L101,-226L109,-222L117,-218L124,-214L132,-210L139,-205L146,-200L153,-195L160,-189L166,-184L173,-178L179,-172L185,-165L190,-159L196,-152L201,-145L206,-138L211,-131L215,-123L219,-116L223,-108L227,-100L230,-92L234,-84L236,-76L239,-68L241,-59L243,-51L245,-42L246,-34L247,-25L248,-16L248,-8L249,0L248,9L248,17L247,26L246,35L245,43L243,52L241,60L239,69L236,77L234,85L230,93L227,101L223,109L219,117L215,124L211,132L206,139L201,146L196,153L190,160L185,166L179,173L173,179L166,185L160,190L153,196L146,201L139,206L132,211L124,215L117,219L109,223L101,227L93,230L85,234L77,236L69,239L60,241L52,243L43,245L35,246L26,247L17,248L9,248Z'); }); diff --git a/test/projection/fit-test.js b/test/projection/fit-test.js index 4e62a7c..402af19 100644 --- a/test/projection/fit-test.js +++ b/test/projection/fit-test.js @@ -40,8 +40,8 @@ it("projection.fitExtent(…) world azimuthalEquidistant", () => { it("projection.fitExtent(…) world conicConformal", () => { const projection = geoConicConformal().clipAngle(30).parallels([30, 60]).rotate([0, -45]); projection.fitExtent([[50, 50], [950, 950]], world); - assertInDelta(projection.scale(), 626.111027, 1e-6); - assertInDelta(projection.translate(), [444.395951, 410.223799], 1e-6); + assertInDelta(projection.scale(), 625.567161, 1e-6); + assertInDelta(projection.translate(), [444.206209, 409.910893], 1e-6); }); it("projection.fitExtent(…) world conicEqualArea", () => { @@ -69,7 +69,7 @@ it("projection.fitExtent(…) world gnomonic", () => { const projection = geoGnomonic().clipAngle(45); projection.fitExtent([[50, 50], [950, 950]], world); assertInDelta(projection.scale(), 450.348233, 1e-6); - assertInDelta(projection.translate(), [500.115138, 556.522620], 1e-6); + assertInDelta(projection.translate(), [500.115138, 556.551304], 1e-6); }); it("projection.fitExtent(…) world mercator", () => { diff --git a/test/snapshots/angleorient30.png b/test/snapshots/angleorient30.png index 4f76de5..6443dde 100644 Binary files a/test/snapshots/angleorient30.png and b/test/snapshots/angleorient30.png differ diff --git a/test/snapshots/azimuthalEqualArea.png b/test/snapshots/azimuthalEqualArea.png index 8ab6ac1..04e3ed2 100644 Binary files a/test/snapshots/azimuthalEqualArea.png and b/test/snapshots/azimuthalEqualArea.png differ diff --git a/test/snapshots/gnomonic.png b/test/snapshots/gnomonic.png index 3aa6dee..2bbfbd1 100644 Binary files a/test/snapshots/gnomonic.png and b/test/snapshots/gnomonic.png differ diff --git a/test/snapshots/orthographic.png b/test/snapshots/orthographic.png index e785554..03d674a 100644 Binary files a/test/snapshots/orthographic.png and b/test/snapshots/orthographic.png differ