Notes:
- The
Origin
is in model coordinates (the coordinate system of the actor’s dataset).
- The
Position
is in world coordinates.
- The
Scale
and Rotation
occur about the Origin
, meaning, the Origin
is the center of rotation. And let me repeat: the Origin
is in model coordinates.
The purpose of setting the Origin
of the actor is to set the center of rotation.
The purpose of setting the Position
is to set the position of the actor in world space.
3,What is the difference between Center and Position?
The Center
of an actor is computed, the Position
of an actor is set. If you change the Position
, the Center
will change. So if you are hoping the set the Position
of the actor to the Center
of the actor, that will cause the Center
to change and therefore they will no longer be equal.
There is the trivial case where the Center
is (0,0,0) and the Position
is also (0,0,0). For example, you could design the geometry of your plane such that (0,0,0) lies at the center of the plane rather than at the corner.
Regarding the precise definition of Center
: VTK computes the Center
by (1) finding the smallest bounding box that encloses all the points in the dataset, using a bounding box in model coordinates that has edges aligned with the model coordinate axes, (2) converting this bounding box to world coordinates, (3) computing a new bounding box that encloses the old one but that has edges aligned with the world coordinate axes, and (4) computing the center of this new bounding box.
For very simple geometries like your plane or like a sphere, the Center
is the geometric center of the dataset expressed in world coordinates. For more complex shapes, the Center
is just a quick approximation so that VTK will know approximately where to put the camera by default so that the camera can see all the actors in the scene.
Apologies that I didn’t answer all your questions, but I’ve already spent more time on this answer than I originally intended. Here is the code for vtkProp3D::ComputeMatrix()
that shows how the transformation between model coordinates and world coordinates is constructed for an actor:
this->Transform->Identity();
this->Transform->PostMultiply();
// shift back to actor's origin
this->Transform->Translate(-this->Origin[0], -this->Origin[1], -this->Origin[2]);
// scale
this->Transform->Scale(this->Scale[0], this->Scale[1], this->Scale[2]);
// rotate
this->Transform->RotateY(this->Orientation[1]);
this->Transform->RotateX(this->Orientation[0]);
this->Transform->RotateZ(this->Orientation[2]);
// move back from origin and translate
this->Transform->Translate(this->Origin[0] + this->Position[0],
this->Origin[1] + this->Position[1], this->Origin[2] + this->Position[2]);