Skip to content

Commit e9fe8dd

Browse files
fix: Normalize coplanar dot product check in intersectLine (#49)
1 parent eb61ec1 commit e9fe8dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Line3.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ class Line3 {
139139
// Lines are not coplanar, stop here
140140
// Coplanar only if the vectors AB, u, v are linearly dependent, i.e AB . (u × v) = 0
141141
const coplanarResult = dc.dot(daCrossDb);
142-
if (!approximatelyEquals(coplanarResult, 0)) {
142+
const normalizedCoplanarResult =
143+
coplanarResult / (dc.lengthSq() * daCrossDb.lengthSq());
144+
if (!approximatelyEquals(normalizedCoplanarResult, 0)) {
143145
return;
144146
}
145147

0 commit comments

Comments
 (0)