Skip to content

Commit

Permalink
fix: Normalize coplanar dot product check in intersectLine (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinshen1101 authored Jun 3, 2022
1 parent eb61ec1 commit e9fe8dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Line3.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ class Line3 {
// Lines are not coplanar, stop here
// Coplanar only if the vectors AB, u, v are linearly dependent, i.e AB . (u × v) = 0
const coplanarResult = dc.dot(daCrossDb);
if (!approximatelyEquals(coplanarResult, 0)) {
const normalizedCoplanarResult =
coplanarResult / (dc.lengthSq() * daCrossDb.lengthSq());
if (!approximatelyEquals(normalizedCoplanarResult, 0)) {
return;
}

Expand Down

0 comments on commit e9fe8dd

Please sign in to comment.