What are exacted differences between Origin,Center and Position of an actor?

Hello,I got this image,but these 3 concepts are still quite confusing for me.

Questions are:
1,Are all the these 3 values relative to world coordinate system(WCS)?

2,The Center is the geometric center of an actor,and
a–it is an intrinsic property of an entity,can’t be changed,so it won’t change in local coordinate system(LCS).
b–in WCS,we should subtract the offset of the Origin.
c–it is the rotation center,and the rotation operations will be around it.
Are all these understandings right?

3,What is the difference between Center and Position?When are they equal?When are they different?

4,Why is the Position [0,0,0] by default?

Notes:

1. The `Origin` is in model coordinates (the coordinate system of the actor’s dataset).
2. The `Position` is in world coordinates.
3. 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]);
``````
3 Likes

By the way, if you want to place the center of your plane at a particular position in world coordinates, here is a recipe to do so:

1. Call `GetCenter()` on the dataset (not the actor itself) to get the center in model coordinates
2. Call `SetOrigin(center)` to set the origin to this center that you just got
3. Given the world coordinate point (P[0], P[1], P[2]) where you want to place the center, call `SetPosition(P[0] - center[0], P[1] - center[1], P[2] - center[2])`.

This will place the center of the actor at `P`, unless I made some silly mistake with the math…

2 Likes