Skip to content

Commit

Permalink
Fix turf-line-arc to generate the correct number of steps in the gene…
Browse files Browse the repository at this point in the history
…rated arc (Turfjs#2525)

* Fixes Turfjs#2524 where lineArc isn't dividing the arc into the correct number of steps. Also a bit related to Turfjs#2446, which should have been fixed a while ago by a previous fix to the previous version of this code (see Turfjs#2142). Including a unit test to make sure we don't go backwards with this approach.

* Flow on changes to turf-sector and turf-angle unit test outputs as a result of fix to turf-line-arc. All changes checked visually using geojson.io, noting start and end coords are identical and it's only the intermediate ones changing due to the curve being smoother by default.

* Update changelog.

* Clarifying what the "steps" param means in the documentation. Haven't rebuilt the readme as generate-readmes needs some work. Will make that a seperate PR though.
  • Loading branch information
smallsaucepan authored Nov 2, 2023
1 parent e5afd5c commit a8de40d
Show file tree
Hide file tree
Showing 29 changed files with 1,818 additions and 702 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
- [`@turf/random`](random) Throws error on invalid bbox inputs (#2172)
- [`@turf/boolean-parallel`](boolean-parallel) Lines with 180 degree angle between them are also considered parallel (#2475)
- [`@turf/unkink-polygon`](unkink-polygon) Fix a maximum call stack size exceeded error with very large polygons (#2504)
- [`@turf/line-arc`](line-arc) Number of arc segments generated wasn't related to steps value passed in (#2524)

## 📖 Documentation
- [`@turf/bbox`][bbox] Improve documentation (#2153)
Expand Down
189 changes: 126 additions & 63 deletions packages/turf-angle/test/out/90-degrees.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,69 @@
[
[124, -22],
[124, -20.333333],
[124.174203, -20.341268],
[124.346782, -20.364998],
[124.51613, -20.404302],
[124.680665, -20.458813],
[124.838844, -20.528022],
[124.989183, -20.611283],
[125.130261, -20.707815],
[125.260739, -20.816714],
[125.379367, -20.936957],
[125.485003, -21.067412],
[125.576614, -21.206849],
[125.653297, -21.353949],
[125.714277, -21.507317],
[125.758928, -21.665495],
[125.786768, -21.826973],
[125.797475, -21.990207],
[124.04425, -20.333844],
[124.088474, -20.335376],
[124.132644, -20.337929],
[124.176735, -20.341501],
[124.22072, -20.346089],
[124.264573, -20.351692],
[124.308266, -20.358305],
[124.351775, -20.365925],
[124.395073, -20.374547],
[124.438134, -20.384166],
[124.480932, -20.394777],
[124.523441, -20.406372],
[124.565636, -20.418945],
[124.607491, -20.432488],
[124.648981, -20.446993],
[124.690081, -20.462452],
[124.730767, -20.478855],
[124.771013, -20.496192],
[124.810795, -20.514453],
[124.850089, -20.533627],
[124.888872, -20.553702],
[124.92712, -20.574667],
[124.964809, -20.596508],
[125.001917, -20.619212],
[125.038421, -20.642766],
[125.074299, -20.667156],
[125.109529, -20.692366],
[125.144089, -20.718382],
[125.177958, -20.745187],
[125.211115, -20.772767],
[125.24354, -20.801103],
[125.275212, -20.830179],
[125.306113, -20.859977],
[125.336223, -20.89048],
[125.365524, -20.921668],
[125.393996, -20.953523],
[125.421623, -20.986025],
[125.448387, -21.019156],
[125.474271, -21.052893],
[125.499259, -21.087218],
[125.523336, -21.122109],
[125.546485, -21.157546],
[125.568692, -21.193505],
[125.589943, -21.229966],
[125.610224, -21.266907],
[125.629523, -21.304304],
[125.647826, -21.342135],
[125.665122, -21.380377],
[125.681399, -21.419006],
[125.696646, -21.457999],
[125.710855, -21.497332],
[125.724014, -21.536981],
[125.736115, -21.576922],
[125.74715, -21.617129],
[125.757111, -21.657579],
[125.76599, -21.698246],
[125.773783, -21.739105],
[125.780482, -21.780132],
[125.786084, -21.8213],
[125.790582, -21.862586],
[125.793975, -21.903962],
[125.796258, -21.945403],
[125.797429, -21.986885],
[125.797488, -22.028381],
[124, -22]
]
Expand All @@ -55,53 +102,69 @@
[
[124, -22],
[126.696439, -22.035218],
[126.682054, -22.280117],
[126.641725, -22.522527],
[126.57571, -22.760099],
[126.484516, -22.990519],
[126.368908, -23.211528],
[126.229905, -23.420951],
[126.068769, -23.616713],
[125.887005, -23.796867],
[125.686343, -23.95961],
[125.468726, -24.10331],
[125.236289, -24.226515],
[124.991339, -24.327981],
[124.73633, -24.406676],
[124.473834, -24.4618],
[124.206514, -24.49279],
[123.937089, -24.499332],
[123.668306, -24.481357],
[123.402902, -24.439049],
[123.143573, -24.372841],
[122.892945, -24.283405],
[122.653537, -24.171653],
[122.427739, -24.038715],
[122.21778, -23.885936],
[122.025708, -23.714854],
[121.853369, -23.527183],
[121.702389, -23.324795],
[121.574161, -23.1097],
[121.469836, -22.884023],
[121.390312, -22.64998],
[121.336236, -22.40986],
[121.307999, -22.165995],
[121.305736, -21.920743],
[121.329335, -21.676463],
[121.378441, -21.435492],
[121.452461, -21.200124],
[121.550581, -20.972591],
[121.671769, -20.755038],
[121.814793, -20.549511],
[121.978233, -20.357933],
[122.160497, -20.182091],
[122.359832, -20.023623],
[122.574347, -19.883997],
[122.802024, -19.764507],
[123.040738, -19.666255],
[123.288275, -19.590147],
[123.54235, -19.536886],
[123.800626, -19.50696],
[126.688162, -22.218141],
[126.665416, -22.400012],
[126.628265, -22.579849],
[126.576855, -22.75668],
[126.511409, -22.929545],
[126.43223, -23.097499],
[126.339701, -23.259623],
[126.234279, -23.415026],
[126.116502, -23.56285],
[125.986979, -23.702275],
[125.846392, -23.832527],
[125.695492, -23.952877],
[125.535093, -24.062653],
[125.366071, -24.161238],
[125.189356, -24.248076],
[125.005929, -24.322678],
[124.816814, -24.384621],
[124.623073, -24.433554],
[124.4258, -24.4692],
[124.22611, -24.491355],
[124.025137, -24.499893],
[123.82402, -24.494767],
[123.623903, -24.476005],
[123.425921, -24.443714],
[123.231195, -24.398077],
[123.040823, -24.339354],
[122.855878, -24.267878],
[122.677392, -24.184053],
[122.506359, -24.088353],
[122.343722, -23.981317],
[122.19037, -23.863547],
[122.047134, -23.735703],
[121.91478, -23.598499],
[121.794008, -23.452698],
[121.685447, -23.29911],
[121.589651, -23.138582],
[121.507098, -22.971999],
[121.43819, -22.800274],
[121.383249, -22.624344],
[121.34252, -22.445167],
[121.316165, -22.263713],
[121.304272, -22.080961],
[121.306846, -21.897892],
[121.323819, -21.715488],
[121.355046, -21.53472],
[121.400308, -21.356549],
[121.459317, -21.181918],
[121.531712, -21.011749],
[121.617071, -20.846936],
[121.714905, -20.688343],
[121.824667, -20.5368],
[121.94575, -20.393097],
[122.077498, -20.25798],
[122.2192, -20.132151],
[122.370104, -20.016261],
[122.529412, -19.910908],
[122.696289, -19.816638],
[122.869865, -19.733934],
[123.049239, -19.663222],
[123.233486, -19.604865],
[123.421658, -19.559163],
[123.612788, -19.526351],
[123.805898, -19.506596],
[124, -19.5],
[124, -22]
]
Expand Down
Loading

0 comments on commit a8de40d

Please sign in to comment.