Skip to content

Commit

Permalink
fix(LineManipulator): fix line manipulator in perpendicular vector case
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigobasilio2022 committed Jan 3, 2024
1 parent 24f82f2 commit 54c6c62
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/Widgets/Manipulators/LineManipulator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ export function projectDisplayToLine(
const denominator = vtkMath.dot(normal, lineDirection);

const result = lineDirection.slice();
vtkMath.multiplyScalar(result, numerator / denominator);
if (denominator === 0) {
// no change is allowed
vtkMath.multiplyScalar(result, 0);
} else {
vtkMath.multiplyScalar(result, numerator / denominator);
}
vtkMath.add(lineOrigin, result, result);

return result;
Expand Down

0 comments on commit 54c6c62

Please sign in to comment.