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

Prevent division by zero in FlyTo when currentCenter == targetCenter #3693

Closed
wants to merge 1 commit into from

Conversation

IvanSanchez
Copy link
Member

An alternative to #3663. Skip division by the distance from start to end when that distance is zero.

@@ -24,7 +24,7 @@ L.Map.include({
rho2 = rho * rho;

function r(i) {
var b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1);
var b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1) / (2 * (i ? w1 : w0) * rho2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's going on here? it can't be removed like that because of the left part of the formula

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wait, I've misread the left part. I was assuming u1 multiplied everything.

@fminuti
Copy link
Contributor

fminuti commented Jul 30, 2015

I don't think this solution is working:
try
http://jsfiddle.net/v1so6m56/10/
where I copied your implementation.

@fminuti
Copy link
Contributor

fminuti commented Jul 30, 2015

Sorry, you changed your implementation while I was writing.
Here http://jsfiddle.net/v1so6m56/12/
the new implementation still not working correctly

@IvanSanchez IvanSanchez deleted the flyto-dividebyzero branch July 30, 2015 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants