Rotating my volume using setUserMatrix results in a skewed volume

I recommend reading the VTK primer: https://vtk.org/vtk-textbook/ to get acquainted with some computational geometry basics and how VTK itself works.

Just wanted to give a small update that I brought simple cone into the viewer and that seems to work just fine with my rotation functions. I will continue moving forward with this working example and see if I can reproduce the problem as you all suggested. This at least was a step in the right direction, even if it is not the answer to my problem.

I am very appreciative all of the advice you have both had to offer. Thank you for your time.

Try to make your cone not center at 0,0,0 and you will start seeing the issue you previously ran into. In your rotation, you will have to translate back and forth around your rotations.

HTH

1 Like

Hello,

Now, please, do as @Sebastien_Jourdain suggested: initialize the cone scene with the cone geometry some units away from the origin (e.g.: +10.0 units along X axis). Then try the rotation again and report the result.

cheers,

Paulo

So here is what happens when I displace the origin to (0.5 , 0.5, 0.5), then rotate the cone:

//example of rotating x axis with displaced origin
api.volumes[0].setOrigin(.5, .5, .5)
api.volumesapi.volumes[0].setOrientation(value, 0, 0)

This looks close to what my object is doing, but I do see one difference: my object is traveling in a figure 8 pattern, while the cone travels in a circle

Thoughts on this? I feel like this might reveal that the problem isn’t that the origin is off-centered.

Here is a cube rotating displaced to (0.5, 0.5, 0.5) just to reproduce the original issue as closely as possible:

To me everything that I’m seeing make sense. I’m not sure what is the remaining question or issue.
It might be good to reset the clipping planes to always see the full object.

Like I said in a very short way before. In order to rotate your object on itself, you need to figure out the center of your object.
Then in your matrix (-translate_center), (rotate), (+translate_center)

1 Like

@Sebastien_Jourdain I have tried rotating with a translation adjustment and the vtk imageData origin has been messing up my end result. Do you know what might cause that?