-
Notifications
You must be signed in to change notification settings - Fork 189
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
BoundingBox calculation fails in certain cases #224
Comments
This should do the trick (Tests: http://jsbin.com/ivomiq/56/, http://jsbin.com/hotakayi/1/ ):
EDIT: Removed unnecessary x,y and commented |
Thanks @timo22345! Will investigate soon. |
Hi @timo22345, thanks for taking the time to report this issue. I investigated a little bit further and found out that casting the intermediate results "a", "b" and "c" to int also fixes the issue. I added visual and unit tests. Do you see any problems with my fix? I searched for the string "http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html" on Github an found several other implementations. Other implementations store the intermediate result as doubles or int. That got me to deal with that approach, too. |
Bounding box calculation fails in this case:
The same in playground here.
Red rectangle shows calculated bbox position. It has wrong left value.
The text was updated successfully, but these errors were encountered: