Skip to content

Commit 68acd11

Browse files
committed
fix(imagereslicemapper): be less sensitive for "snapping" to nearest 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.
1 parent 603d6f9 commit 68acd11

File tree

1 file changed

+5
-1
lines changed
  • Sources/Rendering/OpenGL/ImageResliceMapper

1 file changed

+5
-1
lines changed

Sources/Rendering/OpenGL/ImageResliceMapper/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1131,14 +1131,18 @@ function vtkOpenGLImageResliceMapper(publicAPI, model) {
11311131
shaders.Fragment = FSSource;
11321132
};
11331133

1134+
/**
1135+
* Returns true if the normal is almost axis aligned.
1136+
* Has a side effect to normalize the vector.
1137+
*/
11341138
function isVectorAxisAligned(n) {
11351139
vtkMath.normalize(n);
11361140
const tmpN = [0, 0, 0];
11371141
for (let i = 0; i < 3; ++i) {
11381142
vec3.zero(tmpN);
11391143
tmpN[i] = 1.0;
11401144
const dotP = vtkMath.dot(n, tmpN);
1141-
if (dotP < -0.999 || dotP > 0.999) {
1145+
if (dotP < -0.999999 || dotP > 0.999999) {
11421146
return [true, i];
11431147
}
11441148
}

0 commit comments

Comments
 (0)