Skip to content

Commit

Permalink
fix(imagereslicemapper): be less sensitive for "snapping" to nearest …
Browse files Browse the repository at this point in the history
…orthogonal axis

When using the vtkImageResliceMapper in conjunction with the ResliceCursorWidget(RWC), there was a
case when the RCW lines were displayed partly being the slice when the slice plane was being snapped
to the nearest orthogonal axis.
  • Loading branch information
finetjul authored and floryst committed Oct 25, 2024
1 parent 3b86f71 commit c962c49
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Rendering/OpenGL/ImageResliceMapper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1131,14 +1131,18 @@ function vtkOpenGLImageResliceMapper(publicAPI, model) {
shaders.Fragment = FSSource;
};

/**
* Returns true if the normal is almost axis aligned.
* Has a side effect to normalize the vector.
*/
function isVectorAxisAligned(n) {
vtkMath.normalize(n);
const tmpN = [0, 0, 0];
for (let i = 0; i < 3; ++i) {
vec3.zero(tmpN);
tmpN[i] = 1.0;
const dotP = vtkMath.dot(n, tmpN);
if (dotP < -0.999 || dotP > 0.999) {
if (dotP < -0.999999 || dotP > 0.999999) {
return [true, i];
}
}
Expand Down

0 comments on commit c962c49

Please sign in to comment.