Skip to content

Commit 037f83f

Browse files
committed
fix : units is now used
1 parent 58af163 commit 037f83f

File tree

5 files changed

+524
-523
lines changed

5 files changed

+524
-523
lines changed

packages/turf-ellipse/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { destination } from "@turf/destination";
1111
import { transformRotate } from "@turf/transform-rotate";
1212
import { getCoord } from "@turf/invariant";
13-
import { GeoJsonProperties, Feature, Polygon, Point, Position } from "geojson";
13+
import { GeoJsonProperties, Feature, Polygon, Position } from "geojson";
1414

1515
/**
1616
* Takes a {@link Point} and calculates the ellipse polygon given two semi-axes expressed in variable units and steps for precision.
@@ -148,8 +148,9 @@ function ellipse(
148148
(Math.pow(a * Math.sin(theta), 2) + Math.pow(b * Math.cos(theta), 2))
149149
);
150150
coords.push(
151-
destination(centerCoords, r, angle + radiansToDegrees(theta)).geometry
152-
.coordinates
151+
destination(centerCoords, r, angle + radiansToDegrees(theta), {
152+
units: units,
153+
}).geometry.coordinates
153154
);
154155
}
155156
return polygon([coords], properties);

packages/turf-ellipse/test/out/anti-meridian-degrees.json

Lines changed: 130 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -106,71 +106,71 @@
106106
"type": "Polygon",
107107
"coordinates": [
108108
[
109-
[-180.470205, -16.999461],
110-
[-180.457964, -16.979142],
111-
[-180.434333, -16.965124],
112-
[-180.406011, -16.954269],
113-
[-180.375269, -16.945497],
114-
[-180.343224, -16.938267],
115-
[-180.310525, -16.932253],
116-
[-180.277591, -16.927239],
117-
[-180.244707, -16.923072],
118-
[-180.21208, -16.919634],
119-
[-180.17986, -16.916835],
120-
[-180.148164, -16.9146],
121-
[-180.117078, -16.91287],
122-
[-180.086671, -16.911592],
123-
[-180.056997, -16.910724],
124-
[-180.028096, -16.910227],
125-
[-180, -16.910068],
126-
[-179.971904, -16.910227],
127-
[-179.943003, -16.910724],
128-
[-179.913329, -16.911592],
129-
[-179.882922, -16.91287],
130-
[-179.851836, -16.9146],
131-
[-179.82014, -16.916835],
132-
[-179.78792, -16.919634],
133-
[-179.755293, -16.923072],
134-
[-179.722409, -16.927239],
135-
[-179.689475, -16.932253],
136-
[-179.656776, -16.938267],
137-
[-179.624731, -16.945497],
138-
[-179.593989, -16.954269],
139-
[-179.565667, -16.965124],
140-
[-179.542036, -16.979142],
141-
[-179.529795, -16.999461],
142-
[-179.541936, -17.019834],
143-
[-179.565507, -17.033955],
144-
[-179.593793, -17.044926],
145-
[-179.624514, -17.053815],
146-
[-179.656551, -17.061158],
147-
[-179.689251, -17.067276],
148-
[-179.722194, -17.072384],
149-
[-179.755092, -17.076635],
150-
[-179.787739, -17.080146],
151-
[-179.81998, -17.083007],
152-
[-179.851701, -17.085293],
153-
[-179.882813, -17.087063],
154-
[-179.913247, -17.088371],
155-
[-179.942949, -17.08926],
156-
[-179.971877, -17.089769],
157-
[-180, -17.089932],
158-
[-180.028123, -17.089769],
159-
[-180.057051, -17.08926],
160-
[-180.086753, -17.088371],
161-
[-180.117187, -17.087063],
162-
[-180.148299, -17.085293],
163-
[-180.18002, -17.083007],
164-
[-180.212261, -17.080146],
165-
[-180.244908, -17.076635],
166-
[-180.277806, -17.072384],
167-
[-180.310749, -17.067276],
168-
[-180.343449, -17.061158],
169-
[-180.375486, -17.053815],
170-
[-180.406207, -17.044926],
171-
[-180.434493, -17.033955],
172-
[-180.458064, -17.019834],
173-
[-180.470205, -16.999461]
109+
[-231.255224, -10.832176],
110+
[-229.537115, -9.171208],
111+
[-226.785333, -8.318289],
112+
[-223.616357, -7.809288],
113+
[-220.237616, -7.490076],
114+
[-216.750783, -7.287067],
115+
[-213.215132, -7.158857],
116+
[-209.668909, -7.079876],
117+
[-206.138464, -7.033411],
118+
[-202.642783, -7.008151],
119+
[-199.195982, -6.996301],
120+
[-195.808785, -6.992459],
121+
[-192.489461, -6.992913],
122+
[-189.24444, -6.99517],
123+
[-186.078735, -6.997636],
124+
[-182.996251, -6.999388],
125+
[-180, -7],
126+
[-177.003749, -6.999388],
127+
[-173.921265, -6.997636],
128+
[-170.75556, -6.99517],
129+
[-167.510539, -6.992913],
130+
[-164.191215, -6.992459],
131+
[-160.804018, -6.996301],
132+
[-157.357217, -7.008151],
133+
[-153.861536, -7.033411],
134+
[-150.331091, -7.079876],
135+
[-146.784868, -7.158857],
136+
[-143.249217, -7.287067],
137+
[-139.762384, -7.490076],
138+
[-136.383643, -7.809288],
139+
[-133.214667, -8.318289],
140+
[-130.462885, -9.171208],
141+
[-128.744776, -10.832176],
142+
[-129.549848, -13.068509],
143+
[-131.704315, -15.006667],
144+
[-134.457899, -16.764622],
145+
[-137.558403, -18.370546],
146+
[-140.881596, -19.832788],
147+
[-144.353404, -21.153602],
148+
[-147.923695, -22.333485],
149+
[-151.555203, -23.372894],
150+
[-155.218208, -24.273002],
151+
[-158.887798, -25.036029],
152+
[-162.542409, -25.665364],
153+
[-166.163061, -26.16555],
154+
[-169.732965, -26.542201],
155+
[-173.237347, -26.80186],
156+
[-176.663352, -26.951832],
157+
[-180, -27],
158+
[-183.336648, -26.951832],
159+
[-186.762653, -26.80186],
160+
[-190.267035, -26.542201],
161+
[-193.836939, -26.16555],
162+
[-197.457591, -25.665364],
163+
[-201.112202, -25.036029],
164+
[-204.781792, -24.273002],
165+
[-208.444797, -23.372894],
166+
[-212.076305, -22.333485],
167+
[-215.646596, -21.153602],
168+
[-219.118404, -19.832788],
169+
[-222.441597, -18.370546],
170+
[-225.542101, -16.764622],
171+
[-228.295685, -15.006667],
172+
[-230.450152, -13.068509],
173+
[-231.255224, -10.832176]
174174
]
175175
]
176176
}
@@ -187,71 +187,71 @@
187187
"type": "Polygon",
188188
"coordinates": [
189189
[
190-
[-180, -16.55034],
191-
[-179.978774, -16.561997],
192-
[-179.964091, -16.584565],
193-
[-179.952697, -16.61163],
194-
[-179.943474, -16.641017],
195-
[-179.935858, -16.671656],
196-
[-179.929514, -16.702924],
197-
[-179.924218, -16.734422],
198-
[-179.91981, -16.765874],
199-
[-179.916167, -16.797083],
200-
[-179.913197, -16.827904],
201-
[-179.910821, -16.858226],
202-
[-179.908978, -16.887966],
203-
[-179.907613, -16.917056],
204-
[-179.90668, -16.945447],
205-
[-179.90614, -16.973098],
206-
[-179.905959, -16.999978],
207-
[-179.906114, -17.026859],
208-
[-179.906626, -17.054511],
209-
[-179.907531, -17.082902],
210-
[-179.908869, -17.111994],
211-
[-179.910686, -17.141735],
212-
[-179.913037, -17.172059],
213-
[-179.915986, -17.202882],
214-
[-179.919609, -17.234095],
215-
[-179.924003, -17.26555],
216-
[-179.92929, -17.297052],
217-
[-179.935633, -17.328324],
218-
[-179.943257, -17.358968],
219-
[-179.952501, -17.388359],
220-
[-179.963931, -17.415429],
221-
[-179.978674, -17.438],
222-
[-180, -17.44966],
223-
[-180.021326, -17.438],
224-
[-180.036069, -17.415429],
225-
[-180.047499, -17.388359],
226-
[-180.056743, -17.358968],
227-
[-180.064367, -17.328324],
228-
[-180.07071, -17.297052],
229-
[-180.075997, -17.26555],
230-
[-180.080391, -17.234095],
231-
[-180.084014, -17.202882],
232-
[-180.086963, -17.172059],
233-
[-180.089314, -17.141735],
234-
[-180.091131, -17.111994],
235-
[-180.092469, -17.082902],
236-
[-180.093374, -17.054511],
237-
[-180.093886, -17.026859],
238-
[-180.094041, -16.999978],
239-
[-180.09386, -16.973098],
240-
[-180.09332, -16.945447],
241-
[-180.092387, -16.917056],
242-
[-180.091022, -16.887966],
243-
[-180.089179, -16.858226],
244-
[-180.086803, -16.827904],
245-
[-180.083833, -16.797083],
246-
[-180.08019, -16.765874],
247-
[-180.075782, -16.734422],
248-
[-180.070486, -16.702924],
249-
[-180.064142, -16.671656],
250-
[-180.056526, -16.641017],
251-
[-180.047303, -16.61163],
252-
[-180.035909, -16.584565],
253-
[-180.021226, -16.561997],
254-
[-180, -16.55034]
190+
[-180, 33],
191+
[-177.649663, 31.703957],
192+
[-176.075902, 29.197049],
193+
[-174.899856, 26.193732],
194+
[-173.977415, 22.936144],
195+
[-173.23134, 19.54281],
196+
[-172.614036, 16.082418],
197+
[-172.093927, 12.598902],
198+
[-171.649083, 9.122233],
199+
[-171.263795, 5.673775],
200+
[-170.926553, 2.269246],
201+
[-170.628782, -1.079531],
202+
[-170.364019, -4.363529],
203+
[-170.127356, -7.575789],
204+
[-169.915059, -10.710919],
205+
[-169.724292, -13.764747],
206+
[-169.55293, -16.734064],
207+
[-169.394938, -19.704191],
208+
[-169.246345, -22.760568],
209+
[-169.109071, -25.900205],
210+
[-168.985952, -29.119223],
211+
[-168.881153, -32.41262],
212+
[-168.800816, -35.773947],
213+
[-168.754065, -39.194852],
214+
[-168.754629, -42.664405],
215+
[-168.823498, -46.168062],
216+
[-168.993438, -49.685982],
217+
[-169.316859, -53.190124],
218+
[-169.880034, -56.638822],
219+
[-170.829705, -59.965537],
220+
[-172.425015, -63.051999],
221+
[-175.146105, -65.648285],
222+
[-180, -67],
223+
[-184.853895, -65.648285],
224+
[-187.574985, -63.051999],
225+
[-189.170295, -59.965537],
226+
[-190.119966, -56.638822],
227+
[-190.683141, -53.190124],
228+
[-191.006562, -49.685982],
229+
[-191.176502, -46.168062],
230+
[-191.245371, -42.664405],
231+
[-191.245935, -39.194852],
232+
[-191.199184, -35.773947],
233+
[-191.118847, -32.41262],
234+
[-191.014048, -29.119223],
235+
[-190.890929, -25.900205],
236+
[-190.753655, -22.760568],
237+
[-190.605062, -19.704191],
238+
[-190.44707, -16.734064],
239+
[-190.275708, -13.764747],
240+
[-190.084941, -10.710919],
241+
[-189.872644, -7.575789],
242+
[-189.635981, -4.363529],
243+
[-189.371218, -1.079531],
244+
[-189.073447, 2.269246],
245+
[-188.736205, 5.673775],
246+
[-188.350917, 9.122233],
247+
[-187.906073, 12.598902],
248+
[-187.385964, 16.082418],
249+
[-186.76866, 19.54281],
250+
[-186.022585, 22.936144],
251+
[-185.100144, 26.193732],
252+
[-183.924098, 29.197049],
253+
[-182.350337, 31.703957],
254+
[-180, 33]
255255
]
256256
]
257257
}

0 commit comments

Comments
 (0)