Last active
August 23, 2024 22:51
-
-
Save wchargin/d673b48b8accf3027d47e644c4f7dddf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as turf from "@turf/turf"; // v7.0.0 | |
const coords = (pointFeature) => pointFeature.geometry.coordinates; | |
const pointToLineDistanceOptions = { method: "geodesic" }; | |
// ^ setting "planar" doesn't change things substantively | |
let maxError = -Infinity; | |
let argmaxError; | |
let nErrorOverOnePercent = 0; | |
for (let heading = 0; heading < 360; heading++) { | |
// Distance of points from each other, in kilometers. | |
// Pick a small value so geodesic effects aren't a confounding factor, but | |
// anything from 1µm up to 10km is substantively the same. | |
const km = 1; | |
const origin = turf.point([12, 34]); | |
const forward = turf.destination(origin, km, heading); | |
const line = turf.lineString([coords(origin), coords(forward)]); | |
const toTheRight = heading + 90; | |
const target = turf.destination(origin, km, toTheRight); | |
// this should always be 1km ~exactly, and it is: good | |
const directDistance = turf.distance(target, origin); | |
// this should also be 1km ~exactly, but it can be off by up to 1.8% | |
const lineDistance = turf.pointToLineDistance( | |
target, | |
line, | |
pointToLineDistanceOptions | |
); | |
const error = Math.abs(lineDistance / directDistance - 1); | |
console.log(heading, directDistance, lineDistance, error); | |
if (error > maxError) { | |
maxError = error; | |
argmaxError = { heading, target, line, directDistance, lineDistance }; | |
} | |
if (error > 0.01) { | |
nErrorOverOnePercent++; | |
} | |
} | |
console.log(`Error over 1% in ${nErrorOverOnePercent}/360 samples`); | |
console.log( | |
`Max error: ${(maxError * 100).toFixed(2)}% at ${argmaxError.heading}deg` | |
); | |
console.log("Sample data:"); | |
console.log(`target = ${JSON.stringify(argmaxError.target)}`); | |
console.log(`line = ${JSON.stringify(argmaxError.line)}`); | |
console.log(`directDistance (km) = ${argmaxError.directDistance}`); | |
console.log(`lineDistance (km) = ${argmaxError.lineDistance}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 0.9999999999999923 0.9999999999999923 0 | |
1 0.9999999999998176 1.0000310922079418 0.00003109220812436142 | |
2 0.9999999999999578 1.000124941935449 0.00012494193549117405 | |
3 0.9999999999999347 1.0002807625186663 0.00028076251873154767 | |
4 0.9999999999996406 1.0004972506338414 0.0004972506342009186 | |
5 0.9999999999997848 1.0007726035699125 0.0007726035701278722 | |
6 0.9999999999996438 1.0011045410218202 0.0011045410221768304 | |
7 0.999999999999637 1.0014903323993227 0.0014903323996862117 | |
8 0.9999999999999708 1.0019268291364691 0.0019268291364984425 | |
9 0.9999999999997498 1.002410501412302 0.0024105014125528346 | |
10 0.9999999999998368 1.0029374786308556 0.0029374786310192302 | |
11 0.9999999999997202 1.0035035929422778 0.00350359294255842 | |
12 0.9999999999999065 1.0041044250785773 0.004104425078671259 | |
13 0.9999999999994488 1.0047353517479736 0.00473535174852735 | |
14 0.9999999999997374 1.005391593849511 0.005391593849775056 | |
15 0.9999999999997865 1.0060682647738552 0.006068264774069965 | |
16 0.9999999999996733 1.006760418117469 0.006760418117797817 | |
17 0.9999999999998637 1.007463094163386 0.0074630941635234205 | |
18 0.9999999999993515 1.0081713645494828 0.00817136455013645 | |
19 0.9999999999995005 1.0088803746246775 0.00888037462518132 | |
20 0.9999999999994482 1.0095853830362458 0.009585383036802897 | |
21 0.9999999999994836 1.0102817982121712 0.010281798212692816 | |
22 0.9999999999992997 1.0109652114354575 0.010965211436165578 | |
23 0.9999999999994921 1.0116314263142592 0.011631426314772986 | |
24 0.9999999999992943 1.0122764845160763 0.012276484516790642 | |
25 0.9999999999994603 1.0128966877015728 0.012896687702119491 | |
26 1.0000000000000508 1.01348861566049 0.013488615660438574 | |
27 0.9999999999993241 1.0140491407099428 0.014049140710628238 | |
28 0.9999999999992744 1.0145754384789691 0.014575438479705438 | |
29 0.999999999999073 1.0150649952067592 0.015064995207700216 | |
30 0.9999999999995403 1.0155156117782689 0.015515611778735838 | |
31 0.9999999999995275 1.0159254046931614 0.015925404693641454 | |
32 0.9999999999993467 1.0162928042305375 0.016292804231201385 | |
33 0.9999999999997939 1.0166165500474165 0.016616550047625855 | |
34 0.9999999999991871 1.0168956844873602 0.0168956844881869 | |
35 0.9999999999992084 1.017129543882102 0.017129543882907106 | |
36 0.9999999999994675 1.0173177480808042 0.017317748081346007 | |
37 0.9999999999985099 1.0174601885062577 0.017460188507773866 | |
38 0.9999999999989886 1.0175570149753137 0.017557014976342877 | |
39 0.9999999999990132 1.0176086215139981 0.0176086215150022 | |
40 0.9999999999994709 1.0176156314262164 0.01761563142675482 | |
41 0.9999999999994224 1.0175788817929627 0.017578881793550494 | |
42 0.9999999999989659 1.0174994076246882 0.017499407625740204 | |
43 0.999999999999337 1.0173784258270209 0.017378425827695443 | |
44 0.9999999999993328 1.0172173191399771 0.01721731914065594 | |
45 0.9999999999988696 1.017017620204044 0.017017620205193706 | |
46 0.9999999999987843 1.0167809958618597 0.016780995863095782 | |
47 0.9999999999991431 1.0165092318079252 0.016509231808796265 | |
48 0.9999999999997501 1.0162042176767612 0.016204217677015187 | |
49 0.999999999999029 1.0158679326421214 0.015867932643107707 | |
50 0.9999999999990733 1.015502431592612 0.015502431593553023 | |
51 0.9999999999992744 1.0151098319201224 0.015109831920858907 | |
52 0.9999999999987039 1.0146923009681135 0.01469230096942864 | |
53 0.9999999999996982 1.0142520441628369 0.014252044163142852 | |
54 0.9999999999995774 1.0137912938236195 0.013791293824047868 | |
55 0.9999999999992725 1.0133122986956888 0.013312298696426028 | |
56 0.9999999999988927 1.0128173141634853 0.012817314164606852 | |
57 0.9999999999985674 1.012308593162394 0.01230859316384425 | |
58 0.9999999999989592 1.0117883777699803 0.011788377771033476 | |
59 0.9999999999989765 1.0112588914487275 0.011258891449762443 | |
60 0.999999999998691 1.0107223319363643 0.010722331937687235 | |
61 0.9999999999993636 1.0101808647454973 0.010180864746140106 | |
62 0.9999999999991447 1.0096366172380666 0.009636617238930167 | |
63 0.9999999999992356 1.0090916732753772 0.00909167327614857 | |
64 0.9999999999986601 1.008548068374455 0.00854806837580635 | |
65 0.999999999998111 1.0080077853730056 0.00800778537490987 | |
66 0.9999999999987131 1.007472750546513 0.0074727505478096035 | |
67 0.9999999999984154 1.0069448301580775 0.0069448301596730655 | |
68 0.9999999999984657 1.0064258274158187 0.0064258274173627505 | |
69 0.9999999999989426 1.0059174797832517 0.005917479784315338 | |
70 0.999999999998733 1.0054214566419835 0.0054214566432573275 | |
71 0.9999999999986281 1.0049393572552738 0.00493935725665251 | |
72 0.9999999999991059 1.0044727090120613 0.004472709012959486 | |
73 0.999999999998859 1.004022965928311 0.004022965929456612 | |
74 0.9999999999989128 1.003591507372916 0.0035915073740071524 | |
75 0.9999999999989365 1.0031796369981416 0.003179636999208535 | |
76 0.9999999999982553 1.0027885818457631 0.002788581847512628 | |
77 0.9999999999984275 1.002419491625988 0.002419491627564385 | |
78 0.9999999999990943 1.0020734381129657 0.0020734381138731717 | |
79 0.9999999999981577 1.0017514146761834 0.001751414678029084 | |
80 0.9999999999997414 1.0014543359179697 0.001454335918228633 | |
81 0.9999999999985826 1.0011830373701966 0.001183037371615736 | |
82 0.9999999999995042 1.0009382753052765 0.0009382753057727289 | |
83 0.9999999999991027 1.0007207265622076 0.0007207265631055115 | |
84 0.9999999999993673 1.000530988452666 0.0005309884532991305 | |
85 0.9999999999980935 1.000369578684319 0.000369578686226113 | |
86 0.9999999999987994 1.0002369353255276 0.00023693532672841577 | |
87 0.9999999999994377 1.0001334167719873 0.0001334167725497437 | |
88 0.9999999999983709 1.0000593017412216 0.00005930174285073697 | |
89 0.9999999999983694 1.0000147892762488 0.00001478927787945672 | |
90 0.9999999999992769 0.9999999987349697 1.2643072144769008e-9 | |
91 0.9999999999983724 0.9999999999983725 2.220446049250313e-16 | |
92 0.9999999999983709 0.9999999999983706 2.220446049250313e-16 | |
93 0.9999999999994377 0.9999999999994377 0 | |
94 0.9999999999987994 0.9999999999987993 1.1102230246251565e-16 | |
95 0.999999999998122 0.999999999998122 0 | |
96 0.9999999999993673 0.9999999999993673 0 | |
97 0.9999999999991426 0.9999999999991426 0 | |
98 0.9999999999995269 0.9999999999995269 0 | |
99 0.9999999999985826 0.9999999999985826 0 | |
100 0.9999999999997697 0.9999999999997697 0 | |
101 0.9999999999982203 0.9999999999982203 0 | |
102 0.9999999999990943 0.9999999999990943 0 | |
103 0.9999999999984275 0.9999999999984275 0 | |
104 0.999999999998295 0.9999999999982948 2.220446049250313e-16 | |
105 0.9999999999989788 0.9999999999989788 0 | |
106 0.999999999999003 0.999999999999003 0 | |
107 0.999999999998859 0.999999999998859 0 | |
108 0.9999999999991566 0.9999999999991566 0 | |
109 0.9999999999987349 0.9999999999987349 0 | |
110 0.999999999998733 0.999999999998733 0 | |
111 0.9999999999989426 0.9999999999989426 0 | |
112 0.999999999998527 0.999999999998527 0 | |
113 0.9999999999985434 0.9999999999985434 0 | |
114 0.9999999999987798 0.9999999999987798 0 | |
115 0.999999999998111 0.999999999998111 0 | |
116 0.9999999999987319 0.9999999999987318 1.1102230246251565e-16 | |
117 0.9999999999992356 0.9999999999992356 0 | |
118 0.9999999999992983 0.9999999999992983 0 | |
119 0.9999999999994429 0.9999999999994429 0 | |
120 0.9999999999987729 0.9999999999987729 0 | |
121 0.9999999999989765 0.9999999999989765 0 | |
122 0.9999999999989592 0.9999999999989592 0 | |
123 0.9999999999986566 0.9999999999986566 0 | |
124 0.9999999999988927 0.9999999999988927 0 | |
125 0.9999999999993662 0.9999999999993662 0 | |
126 0.9999999999996736 0.9999999999996736 0 | |
127 0.9999999999997969 0.9999999999997969 0 | |
128 0.9999999999988046 0.9999999999988046 0 | |
129 0.9999999999992744 0.9999999999992744 0 | |
130 0.9999999999990733 0.9999999999990733 0 | |
131 0.9999999999991364 0.9999999999991364 0 | |
132 0.9999999999998598 0.9999999999998598 0 | |
133 0.9999999999991431 0.9999999999991431 0 | |
134 0.9999999999988981 0.9999999999988981 0 | |
135 0.9999999999988696 0.9999999999988696 0 | |
136 0.9999999999993328 0.9999999999993328 0 | |
137 0.9999999999994567 0.9999999999994567 0 | |
138 0.9999999999990876 0.9999999999990876 0 | |
139 0.9999999999994224 0.9999999999994224 0 | |
140 0.9999999999994709 0.9999999999994709 0 | |
141 0.9999999999990132 0.9999999999990132 0 | |
142 0.9999999999991175 0.9999999999991177 2.220446049250313e-16 | |
143 0.9999999999986405 0.9999999999986405 0 | |
144 0.9999999999994675 0.9999999999994675 0 | |
145 0.9999999999992084 0.9999999999992084 0 | |
146 0.9999999999993229 0.9999999999993229 0 | |
147 0.9999999999999313 0.9999999999999313 0 | |
148 0.9999999999993467 0.9999999999993469 2.220446049250313e-16 | |
149 0.9999999999996679 0.9999999999996679 0 | |
150 0.9999999999996823 0.9999999999996823 0 | |
151 0.9999999999993596 0.9999999999993596 0 | |
152 0.9999999999992744 0.9999999999992744 0 | |
153 0.99999999999947 0.99999999999947 0 | |
154 1.0000000000000508 1.0000000000000508 0 | |
155 0.9999999999994603 0.9999999999994603 0 | |
156 0.9999999999994439 0.9999999999994439 0 | |
157 0.9999999999994921 0.9999999999994921 0 | |
158 0.9999999999994513 0.9999999999994513 0 | |
159 0.9999999999996368 0.999999999999637 2.220446049250313e-16 | |
160 0.9999999999994482 0.9999999999994482 0 | |
161 0.9999999999998102 0.9999999999998102 0 | |
162 0.9999999999995075 0.9999999999995075 0 | |
163 0.9999999999998637 0.9999999999998637 0 | |
164 0.9999999999996733 0.9999999999996733 0 | |
165 0.9999999999997865 0.9999999999997865 0 | |
166 0.9999999999997374 0.9999999999997373 1.1102230246251565e-16 | |
167 0.9999999999994488 0.9999999999994488 0 | |
168 0.9999999999999065 0.9999999999999065 0 | |
169 1.0000000000000417 1.0000000000000417 0 | |
170 0.9999999999998368 0.9999999999998368 0 | |
171 0.9999999999997498 0.9999999999997498 0 | |
172 0.9999999999999708 0.9999999999999708 0 | |
173 0.9999999999997996 0.9999999999997996 0 | |
174 0.9999999999999696 0.9999999999999696 0 | |
175 0.9999999999997848 0.9999999999997848 0 | |
176 0.9999999999998042 0.9999999999998042 0 | |
177 1.0000000000000984 1.0000000000000986 2.220446049250313e-16 | |
178 0.9999999999999578 0.9999999999999578 0 | |
179 0.9999999999999815 0.9999999999999813 1.1102230246251565e-16 | |
180 0.9999999999999923 1.0000000014010904 1.4010981264078737e-9 | |
181 1.0000000000000546 1.0000319192578693 0.00003191925781464988 | |
182 0.9999999999999661 1.0001265678206335 0.00012656782066744476 | |
183 1.000000000000069 1.0002831579859885 0.00028315798591949104 | |
184 1.0000000000000098 1.0005003859002697 0.0005003859002599143 | |
185 1.0000000000001457 1.000776448814381 0.0007764488142352199 | |
186 1.0000000000002325 1.0011090668497642 0.0011090668495314926 | |
187 1.0000000000001599 1.0014955102685075 0.0014955102683473775 | |
188 1.0000000000001754 1.0019326317375745 0.0019326317373986601 | |
189 1.0000000000001463 1.0024169029977088 0.0024169029975620315 | |
190 1.0000000000002376 1.0029444552817208 0.002944455281482572 | |
191 1.0000000000001952 1.0035111227751137 0.0035111227749178298 | |
192 1.0000000000004228 1.0041124883868024 0.004112488386377899 | |
193 1.0000000000001914 1.0047439310769448 0.004743931076752528 | |
194 1.0000000000002753 1.005400674006712 0.00540067400643518 | |
195 1.0000000000006266 1.0060778327786069 0.006077832777976466 | |
196 1.000000000000318 1.006770463090497 0.006770463090176815 | |
197 1.000000000000761 1.0074736071642991 0.007473607163532403 | |
198 1.00000000000045 1.008182338367502 0.00818233836704807 | |
199 1.000000000000561 1.0088918035269112 0.008891803526345221 | |
200 1.000000000000349 1.009597262488212 0.009597262487859526 | |
201 1.0000000000004892 1.0102941245688963 0.010294124568402063 | |
202 1.0000000000005311 1.0109779816185203 0.010977981617983357 | |
203 1.000000000000994 1.0116446374800123 0.011644637479006681 | |
204 1.000000000000629 1.0122901337188346 0.01229013371819776 | |
205 1.000000000000477 1.0129107715695365 0.012910771569053292 | |
206 1.000000000000696 1.0135031300785338 0.01350313007782833 | |
207 1.0000000000007057 1.0140640805252625 0.014064080524546885 | |
208 1.0000000000003832 1.0145907972246575 0.014590797224268703 | |
209 1.0000000000005056 1.0150807648600233 0.015080764859510154 | |
210 1.0000000000007143 1.0155317825466252 0.01553178254589982 | |
211 1.000000000000741 1.015941964836659 0.015941964835906264 | |
212 1.0000000000008569 1.0163097399188474 0.016309739917976573 | |
213 1.0000000000007767 1.0166338452543122 0.016633845253522628 | |
214 1.0000000000007112 1.0169133209277188 0.0169133209269956 | |
215 1.0000000000007285 1.0171475009774147 0.017147500976673724 | |
216 1.0000000000004858 1.017336002968991 0.0173360029684968 | |
217 1.0000000000007545 1.01747871608461 0.017478716083842327 | |
218 1.0000000000003197 1.0175757879708103 0.01757578797048498 | |
219 1.000000000000626 1.017627610596548 0.017627610595911003 | |
220 1.0000000000013303 1.0176348053360031 0.01763480533464934 | |
221 1.000000000000819 1.0175982075016925 0.017598207500859164 | |
222 1.000000000000812 1.0175188505165242 0.017518850515698015 | |
223 1.000000000000995 1.0173979498959447 0.017397949894932374 | |
224 1.0000000000008926 1.0172368872086701 0.017236887207762175 | |
225 1.0000000000011493 1.0170371941492737 0.017037194148104895 | |
226 1.0000000000004554 1.0168005368490705 0.016800536848607495 | |
227 1.0000000000010494 1.0165287005397823 0.01652870053871558 | |
228 1.0000000000011997 1.0162235746340786 0.016223574632859394 | |
229 1.0000000000008231 1.0158871383334518 0.01588713833261557 | |
230 1.000000000000776 1.0155214467987204 0.015521446797932326 | |
231 1.0000000000008495 1.0151286179328873 0.015128617932024913 | |
232 1.0000000000010578 1.0147108198275288 0.01471081982645539 | |
233 1.0000000000017015 1.0142702588766248 0.014270258874899078 | |
234 1.00000000000092 1.013809168586489 0.013809168585556364 | |
235 1.0000000000012994 1.0133297990937449 0.013329799092428152 | |
236 1.0000000000010922 1.0128344073606912 0.012834407359584965 | |
237 1.0000000000004843 1.0123252480781826 0.012325248077692308 | |
238 1.0000000000006457 1.0118045652402772 0.011804565239623921 | |
239 1.000000000000486 1.0112745843733555 0.011274584372863883 | |
240 1.0000000000009492 1.0107375054085657 0.010737505407606207 | |
241 1.0000000000012943 1.0101954961602806 0.010195496158973194 | |
242 1.000000000001255 1.0096506863946917 0.009650686393424479 | |
243 1.000000000001634 1.009105162454935 0.009105162453286075 | |
244 1.0000000000009381 1.0085609624042904 0.008560962403344252 | |
245 1.0000000000008067 1.0080200716746366 0.008020071673823459 | |
246 1.000000000001216 1.0074844191655103 0.0074844191642853275 | |
247 1.000000000000947 1.006955873782851 0.006955873781897326 | |
248 1.0000000000012315 1.0064362413774421 0.006436241376202689 | |
249 1.000000000001053 1.0059272620454245 0.0059272620443653334 | |
250 1.0000000000011848 1.0054306077746646 0.005430607773473373 | |
251 1.000000000000941 1.0049478803929923 0.004947880392046633 | |
252 1.0000000000007476 1.004480609806859 0.0044806098061080935 | |
253 1.0000000000015516 1.0040302524884241 0.0040302524868662815 | |
254 1.0000000000014566 1.0035981901864666 0.003598190185004624 | |
255 1.0000000000008291 1.0031857288534465 0.0031857288526147 | |
256 1.000000000000774 1.002794097746114 0.002794097745337787 | |
257 1.0000000000008924 1.0024244486832086 0.002424448682313951 | |
258 1.0000000000010902 1.0020778554479746 0.0020778554468821042 | |
259 1.000000000001125 1.00175531330953 0.0017553133084029504 | |
260 1.000000000001337 1.0014577386450076 0.0014577386436687156 | |
261 1.0000000000011844 1.001185968653426 0.001185968652240188 | |
262 1.0000000000013956 1.0009407611382715 0.0009407611368745794 | |
263 1.0000000000008944 1.000722794350182 0.0007227943492869038 | |
264 1.0000000000011628 1.0005326668825576 0.0005326668813940838 | |
265 1.0000000000008191 1.0003708975936205 0.0003708975928011782 | |
266 1.0000000000006901 1.0002379255696998 0.00023792556900947837 | |
267 1.0000000000009241 1.0001341100968493 0.00013411009592489975 | |
268 1.0000000000016362 1.00005973065462 0.000059730652983702726 | |
269 1.0000000000011064 1.0000149869130204 0.00001498691191392787 | |
270 1.0000000000016471 1.0000000000016471 0 | |
271 1.0000000000011064 1.0000000000011064 0 | |
272 1.0000000000016307 1.0000000000016307 0 | |
273 1.0000000000009241 1.0000000000009241 0 | |
274 1.0000000000006901 1.0000000000006901 0 | |
275 1.000000000000805 1.000000000000805 0 | |
276 1.0000000000011628 1.0000000000011628 0 | |
277 1.0000000000008944 1.0000000000008944 0 | |
278 1.0000000000013956 1.0000000000013956 0 | |
279 1.0000000000011844 1.0000000000011844 0 | |
280 1.0000000000013085 1.0000000000013085 0 | |
281 1.000000000001094 1.0000000000010942 2.220446049250313e-16 | |
282 1.0000000000010902 1.0000000000010902 0 | |
283 1.0000000000008555 1.0000000000008555 0 | |
284 1.000000000000774 1.000000000000774 0 | |
285 1.0000000000008291 1.0000000000008291 0 | |
286 1.0000000000014566 1.0000000000014566 0 | |
287 1.0000000000014562 1.0000000000014562 0 | |
288 1.0000000000007476 1.0000000000007476 0 | |
289 1.0000000000008347 1.0000000000008347 0 | |
290 1.0000000000011848 1.000000000001185 2.220446049250313e-16 | |
291 1.000000000001053 1.000000000001053 0 | |
292 1.0000000000011087 1.0000000000011087 0 | |
293 1.000000000000947 1.000000000000947 0 | |
294 1.0000000000011493 1.0000000000011493 0 | |
295 1.0000000000007376 1.0000000000007376 0 | |
296 1.0000000000008664 1.0000000000008664 0 | |
297 1.0000000000014853 1.0000000000014853 0 | |
298 1.000000000001255 1.000000000001255 0 | |
299 1.0000000000012148 1.0000000000012148 0 | |
300 1.0000000000009492 1.0000000000009492 0 | |
301 1.0000000000003173 1.0000000000003173 0 | |
302 1.0000000000006457 1.0000000000006457 0 | |
303 1.0000000000004843 1.0000000000004843 0 | |
304 1.0000000000010922 1.0000000000010922 0 | |
305 1.0000000000011116 1.0000000000011116 0 | |
306 1.0000000000008236 1.0000000000008236 0 | |
307 1.000000000001603 1.000000000001603 0 | |
308 1.0000000000010578 1.000000000001058 2.220446049250313e-16 | |
309 1.0000000000008495 1.0000000000008495 0 | |
310 1.000000000000776 1.0000000000007758 2.220446049250313e-16 | |
311 1.0000000000008231 1.0000000000008231 0 | |
312 1.0000000000010905 1.0000000000010905 0 | |
313 1.0000000000010494 1.0000000000010494 0 | |
314 1.0000000000004554 1.0000000000004554 0 | |
315 1.0000000000009177 1.0000000000009177 0 | |
316 1.0000000000007747 1.0000000000007747 0 | |
317 1.0000000000008753 1.0000000000008753 0 | |
318 1.0000000000005684 1.0000000000005684 0 | |
319 1.000000000000819 1.0000000000008191 2.220446049250313e-16 | |
320 1.0000000000010794 1.0000000000010794 0 | |
321 1.000000000000499 1.000000000000499 0 | |
322 1.0000000000003197 1.0000000000003197 0 | |
323 1.0000000000007545 1.0000000000007545 0 | |
324 1.0000000000004858 1.0000000000004858 0 | |
325 1.0000000000007285 1.0000000000007285 0 | |
326 1.0000000000005758 1.0000000000005758 0 | |
327 1.0000000000007767 1.0000000000007767 0 | |
328 1.0000000000008569 1.0000000000008566 2.220446049250313e-16 | |
329 1.0000000000006006 1.0000000000006006 0 | |
330 1.0000000000007143 1.0000000000007143 0 | |
331 1.0000000000003624 1.0000000000003624 0 | |
332 1.0000000000003832 1.0000000000003832 0 | |
333 1.0000000000007057 1.0000000000007057 0 | |
334 1.000000000000696 1.000000000000696 0 | |
335 1.0000000000003284 1.0000000000003284 0 | |
336 1.0000000000004796 1.0000000000004796 0 | |
337 1.0000000000008433 1.0000000000008433 0 | |
338 1.0000000000005311 1.0000000000005311 0 | |
339 1.0000000000004892 1.000000000000489 2.220446049250313e-16 | |
340 1.0000000000001952 1.0000000000001952 0 | |
341 1.0000000000002514 1.0000000000002514 0 | |
342 1.00000000000045 1.00000000000045 0 | |
343 1.0000000000006044 1.0000000000006044 0 | |
344 1.0000000000001603 1.0000000000001603 0 | |
345 1.0000000000004687 1.0000000000004687 0 | |
346 1.0000000000002753 1.0000000000002753 0 | |
347 1.000000000000032 1.000000000000032 0 | |
348 1.0000000000002627 1.0000000000002627 0 | |
349 1.0000000000001952 1.0000000000001952 0 | |
350 1.0000000000000764 1.0000000000000764 0 | |
351 0.9999999999999849 0.9999999999999849 0 | |
352 1.0000000000001754 1.0000000000001754 0 | |
353 1.0000000000001599 1.0000000000001599 0 | |
354 0.9999999999999069 0.9999999999999069 0 | |
355 1.0000000000001457 1.0000000000001457 0 | |
356 1.0000000000000098 1.0000000000000098 0 | |
357 0.9999999999999056 0.9999999999999056 0 | |
358 0.9999999999999661 0.9999999999999661 0 | |
359 0.9999999999998905 0.9999999999998905 0 | |
Error over 1% in 82/360 samples | |
Max error: 1.76% at 220deg | |
Sample data: | |
target = {"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[11.991689565382663,34.00578044047174]}} | |
line = {"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[12,34],[11.993027757380355,33.99311060965808]]}} | |
directDistance (km) = 1.0000000000013303 | |
lineDistance (km) = 1.0176348053360031 |
Author
wchargin
commented
Aug 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment