File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -98,11 +98,13 @@ left hand side of line a-b, and b lies at the right side of ac."
98
98
" normal vector for the plane on which three points (a b c) lie."
99
99
(normalize-vector (v* (v- b a) (v- c a))))
100
100
101
- (defun vector-angle (v1 v2 &optional (normal (normalize-vector (v* v1 v2))))
101
+ (defun vector-angle (v1 v2 &optional (normal (normalize-vector (v* v1 v2))) (parallel-thre 1e-10 ) )
102
102
" Compute angle (radian) between two vectors, v1 and v2.
103
103
Normal is vertical to both v1 and v2.
104
104
v1, v2 and normal must be normalized in advance.
105
105
Normal must be given if the sign of the angle is needed."
106
+ (if (< (norm2 (v* v1 v2)) parallel-thre)
107
+ (return-from vector-angle (if (> (v. v1 v2) 0 ) 0.0 pi )))
106
108
(atan (v.* normal v1 v2) (v. v1 v2)) )
107
109
108
110
(defun face-normal-vector (vertices)
You can’t perform that action at this time.
0 commit comments