I can’t get the clip plane to match the reslice cursor widget planes.
const cut3DPlane = vtkPlane.newInstance();
cut3DPlane.setNormal(...resliceWidgetState.getPlanes()[xyzToViewType].normal); //this is working
cutPlane.setOrigin(...resliceWidgetState.getCenter()); //this does not work
The error of cutPlane has been when writing the code here in my code is fine, that is not the problem.
The problem is that the range of values obtained from resliceWidgetState.getCenter() goes from 0 to 181.
These values are much higher than what cut3DPlane needs.
For example if I set cut3DPlane.setOrigin(0, resliceWidgetState.getCenter(), 0) the cube disappears when moving resliceCursorWidget.
the values that cut3DPlane.setOrigin needs are much smaller, for example cut3DPlane.setOrigin(0,-0.2,0) this will for example cut the cube approximately in half as seen in the picture above.
By playing with your code and example, it seems that the problem comes from the clipping plane equation being sent to the shader (in getClippingPlaneInDataCoords() or in vtkPolyDataMapper.setMapperShaderParameters).
It is as if the cube while being 100x100x100 gets cut with a plane origin between 0.5 and -0.5.
Actually, what I suggested is correct, the bug you are experiencing is related to issue !2225 .
That issue has been fixed, so if you update your code to master (v26), you won’t have the problem anymore.