-
Notifications
You must be signed in to change notification settings - Fork 47
[lisp/geo/geopack.l] normalize norm vector in optional arugment of vector-angle function. #262
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
Conversation
…ctor-angle function.
If only first commit, efd0371, nan is returned for parallel v1 and v2. So I added second commit, |
72cd2b3
to
7f491ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems ok except (parallel-thre 1e-10)
how did you find this value?
https://github.com/euslisp/jskeus/blob/master/irteus/irtmath.l#L71
https://github.com/euslisp/EusLisp/blob/master/lisp/geo/geopack.l#L53-L60
cc: @YoheiKakiuchi
No reasonable reason, but just intuition. So welcome for any opinion or idea for this. |
Formar euslisp was developed for 32bit OS. see calculation of epsilon: |
I think that in the case of this PR, low precision of float value becomes more safe result.
|
@YoheiKakiuchi so 1e-6 for 32 and 1e-15 for 64? |
I find good solution. ;; (v* #f(1 0 0) #f(1 0 0)) is #f(0 0 0)
# eusgl
1.eusgl$ (let* ((normal (normalize-vector (v* #f(1 0 0) #f(1 0 0)))))
(print (list (equal normal (float-vector 0 0 0))
(equal normal (float-vector *nan* *nan* *nan*))))
)
(nil t)
# irteusgl
1.irteusgl$ (let* ((normal (normalize-vector (v* #f(1 0 0) #f(1 0 0)))))
(print (list (equal normal (float-vector 0 0 0))
(equal normal (float-vector *nan* *nan* *nan*))))
)
(t nil) |
Please review new PR #264 . (I did not break this PR branch so that we can see the discussion with original PR source code later.) |
For longer perspective, I think we should change 'norm' behavior and merge #264, but merged for now. |
Maybe you mean |
As described in document https://github.com/euslisp/EusLisp/blob/master/lisp/geo/geopack.l#L104, normal argument should be unit length. Default value of optional argument is very bad because
(v* v1 v2)
does not become unit-length when v1 and v2 have some angle (> 0).This PR makes euslisp/jskeus#485 test pass.