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

bug in discrete-bezier-curve #5

Open
gas2serra opened this issue Mar 30, 2017 · 1 comment
Open

bug in discrete-bezier-curve #5

gas2serra opened this issue Mar 30, 2017 · 1 comment

Comments

@gas2serra
Copy link

There is a bug in defun discrete-bezier-curve.
Sometimes it calls (atan 0.0 0.0), spec [1] specifies that:

If both are supplied, number2 can be zero provided number1 is not zero.
The problem is fixed using a safe version of atan:

 (safe-atan (x y)
	     (if (and (= x 0) (= y 0))
		 0
		 (atan x y)))

I'm not sure if "0" is the correct answer.

Regards,
Alessandro

[1] http://clhs.lisp.se/Body/f_asin_.htm

@fjolliton
Copy link
Owner

The problem is that two consecutive points must be disjoint.

Actually there should be no attempt to compute atan in the first place for these points.

The correct solution, I think, is to either filter out these points (either at the user responsibility, and maybe here in the code as a first pass before subdividing) or simply to reject such paths.

However, this could also happen because of the subdivision itself, but it would surprise me in this case.

(Sorry for the late reply.)

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

No branches or pull requests

2 participants