The data I’ve been referring to has been for thevtkActor
. When getting origin of vtkImage
, the origin is placed at the min bounds of XYZ.
vtkActor Data:
getOrigin: [0,0,0]
getCenter: [-0.724395751953125, -138.78439331054688, -0.5]
So I try translating so that my center is moved to my origin, rotating, then moving back:
const newMatrix = vtkMatrixBuilder
.buildFromDegree()
.translate(-0.724395751953125, -138.78439331054688, -0.5)
.rotateZ(10)
.translate(0.724395751953125, 138.78439331054688, 0.5)
api.volumes[0].setUserMatrix(newMatrix.matrix)
this only nudges my object a little bit, then performs the transformation similar in the video.
vtkImage Data:
getOrigin: [-405.971, -544.031, -120.5] //these are the min bounds
getCenter: [-0.724395751953125, -138.78439331054688, -0.5]
so I try translating to min bounds, rotating, translate back:
const newMatrix = vtkMatrixBuilder
.buildFromDegree()
.translate(-405.97100830078125, -544.031005859375, -120.5)
.rotateZ(value)
.translate(405.97100830078125, 544.031005859375, 120.5)
api.volumes[0].setUserMatrix(newMatrix.matrix)
Here is the behavior of that one:
As you can see, the object is rotating around an origin much closer to the center of the object but its still a ways off. I will try adding different values to the translation to see if I can get it to rotate at the center of my object. Please let me know if anything sticks out to you that I am doing wrong. Thank you.