C4D has a complex coordinate system.
For the problem I am asking, I don't wish to have a general theory answer, concerning the coordinates system, but to obtain precise answers.
Here is my problem:
For a polygon, we can get easily the array of points and then display the position of this points as follows:
tabPoint = polygon.GetAllPoints()
for point in tabPoint:
But I would like to knowhow to display the position of points of this polygon in the World coordinates ?
Then if I change the World coordinates of some points, how to convert this coordinates for modify the array of points for this polygon ?
I indicate below in what order are these two questions:
You may want to know why I am asking these questions, here is the reason.
I have two polygons that represent cliffs, but they do not coincide very well.
I have to bring closer the dots of theses cliffs to obtain a perfect join.
I'm doing this work to make a canyon that I started in opensim (see link below)
my cliffs before the junction of points
My points alignment algorithm works well, but I'm stumbling on that damned C4D coordinate system !
Get the object's (polygon, in this case) world matrix through GetMg(). Multiply the point's coordinates with that matrix to transform their local coordinates into world coordinates. Use the inverted matrix to convert the world coordinates back.
(It is really hard to answer that without general theory.)
Indeed, it is necessary to use two matrices
For an object named polygonName, we will have:
Matrix = polygonName.GetMg ()
inverseMatrix = ~ Matrix
Matrix converts local coordinates to global coordinates.
After finishing working in global coordinates, we return to local coordinates with inverseMatrix
We can thus modify the polygon with the new local coordinates.
These two matrices allow to work with the points, which is very convenient.
This subject is very well explained here: