Let me explain.
My problem may be complicated to understand, but my final request is very simple.
In C4D, I've got into the habit of creating my 3D objects with splines, which allows me to create objects of any kind.
I do this with Python.
So to create a ring, I create 4 splines. Then, with these 4 splines, I create the ring.
If my 4 splines are centered on the point (0,0,0) as shown in the image below, my ring lies on the XZ plane.
The axis center of the ring is also on the point (0,0,0). What's more, it's well oriented, as its Y axis corresponds to the Y axis of my ring.
Furthermore, the X axis of the axis center is aligned with the segments connecting the point (0,0,0) with the first points of my construction splines.
In this case, everything is perfect.
Figure 1
However, if the center of my 4 splines is elsewhere and the orientation is arbitrary, as shown in the image below, this is where the problem arises.
After creating my ring, the axis center remains at the point (0,0,0) and its orientation is identical to the previous case.
Figure 2
So I need to use Python to bring the axis center back to the center of my ring (translation).
Next, I need to rotate the axis center so that its Y axis is perpendicular to the plane of my ring.
Next, I need to rotate the axis center around its Y axis, so that its X axis is parallel to the segments connecting the center of the ring with the first points of my construction splines.
In conclusion:
I need the following functions:
- a function that allows the translation of the axis center, from a point A to a point B
- a function that allows the rotation of the axis center around its X axis
- a function that allows the rotation of the axis center around its Y axis
- a function that allows the rotation of the axis center around its Z axis