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

rhumbBearing returns NaN for certain coordinates #2569

Open
jellyedwards opened this issue Jan 15, 2024 · 1 comment
Open

rhumbBearing returns NaN for certain coordinates #2569

jellyedwards opened this issue Jan 15, 2024 · 1 comment

Comments

@jellyedwards
Copy link

Hi, it seems rhumbBearing returns NaN for certain coordinates. I'm not calling this directly but just trying to rotate a polygon & stepped through while debugging. bearing works but transformRotate uses rhumbBearing.

repro code:

const pivot = [0, 91];
const pointCoords = [0, 0];
console.log(turf.rhumbBearing(pivot, pointCoords)); // NaN

Thanks!

@NSUSpray
Copy link

NSUSpray commented Feb 27, 2024

I found that there is a problem in the calculateRhumbBearing function: when I try to apply rotation with arguments from (pivot) [325, 212.5] and to (pointCoords) [375.5, 313], then phi1 becomes 3.7 and phi2 becomes 5.5, then the logarithm argument in the expression deltaPsi is equal -0.75, i.e. less than zero!

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

3 participants