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

Fix Phaser.Line.intersectsPoints for floating point inaccuracy. #865

Merged
merged 1 commit into from Jun 1, 2014
Merged

Fix Phaser.Line.intersectsPoints for floating point inaccuracy. #865

merged 1 commit into from Jun 1, 2014

Conversation

woutercommandeur
Copy link
Contributor

This rounds the intersection result to 3 decimals. Should be accurate enough.
See: http://www.html5gamedevs.com/topic/6840-phaserlineintersects-does-not-work-for-floats/

photonstorm added a commit that referenced this pull request Jun 1, 2014
Fix Phaser.Line.intersectsPoints for floating point inaccuracy.
@photonstorm photonstorm merged commit c025b95 into phaserjs:dev Jun 1, 2014
@photonstorm
Copy link
Collaborator

👍

@teachar
Copy link

teachar commented Jun 2, 2014

Cooog

result.y = ((a2 * c1) - (a1 * c2)) / denom;
/*
Round to 3 decimals here, due to javascript floating point is 'broken'
http://stackoverflow.com/questions/11832914/round-to-at-most-2-decimal-places-in-javascript
Copy link

Choose a reason for hiding this comment

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

G

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