-
Notifications
You must be signed in to change notification settings - Fork 944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed multiple modules that were performing scalar instead of spherical calculations #2717
Fixed multiple modules that were performing scalar instead of spherical calculations #2717
Conversation
…ns when they should have been doing spherical (3D). Most changes were to nearestPointOnLine. pointToLineDistance now uses nearestPointOnLine for spherical calculations. Flow on corrections impacted lineSlice and nearestPointToLine as well. Tidied up some tests - fixed module name in test definitions, added a benchmark overall time in a few places for easier comparisons.
Btw, benchmark performance tests for nearestPointOnLine were unchanged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor feedback, otherwise looks good on scan review. I don't follow the vector math deeply, but trust that you faithfully reimplemented the source. And I see that all of the added tests demonstrate improvement.
posA: Position, | ||
posB: Position, | ||
posC: Position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth clarifying what each parameter is expected to be? I see you passing the posA - start point of segment, posB - end point of segment, posC - point to find nearest point on segment.
Thanks @twelch. Will implement all those suggestions and merge shortly. |
…ans and toDegrees functions from turf-helpers.
…iansToDegress and degreesToRadians from turf-helpers. It seems (degrees * Math.PI) / 180 can sometimes differ slightly from degrees * (Math.PI / 180).
Nice, this is just what i needed! |
Just what I was looking for! :) |
Fixed multiple modules that were performing scalar (2D) calculations when they should have been doing spherical (3D).
Most changes were to nearestPointOnLine. pointToLineDistance now uses nearestPointOnLine for spherical calculations. Flow on corrections impacted lineSlice and nearestPointToLine as well.
Should fix some long standing issues, and be a step towards Turf being internally consistent. For example, a point returned by nearestPointOnLine should have a pointToLineDistance of 0. Or (eventually) return true for booleanPointOnLine.
Resolves #965
Resolves #1156
Resolves #1514
Resolves #1878
Resolves #2023
Resolves #2234
Resolves #2270