Skip to content
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

Interpolate should bail early if an exact distance match is found #2743

Open
KilianB opened this issue Nov 4, 2024 · 1 comment
Open

Interpolate should bail early if an exact distance match is found #2743

KilianB opened this issue Nov 4, 2024 · 1 comment

Comments

@KilianB
Copy link

KilianB commented Nov 4, 2024

Is there a logic error in the fast path of the following code? If the certeroid in interpolate is an exact match zw is set to the value of the feature but the forEach loop is not aborted.

This means that we should have a different result depending on which order the points are checked. If the point is found at the end of the feature set the zValue will be taken from the feature, if it's one of the first points it would just be accounted for as normal.

https://github.com/Turfjs/turf/blob/1dec2f2474ba37ca3cb40e492ba85f70aecd055a/packages/turf-interpolate/index.js#L94C1-L95C1

@smallsaucepan
Copy link
Member

Thanks for raising this @KilianB. Would you mind taking a look at #1601 and seeing how it's related? Are the two issues suggesting the same outcome for different reasons?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants