axis rotation
-
On 05/02/2013 at 11:59, xxxxxxxx wrote:
User Information:
Cinema 4D Version: r13
Platform: Windows ;
Language(s) : C++ ;---------
Hi,how can i apply a rotation like i do in the editor when enabling axis modification?
i thought it could be SetModelingAxis, but what do i need to apply when i want a rotation of (0/0/-90)..thanks in advance,
ello -
On 05/02/2013 at 12:56, xxxxxxxx wrote:
If it should work like rotating in the Axis mode, you have to do it in two steps:
- Rotate the object
- Rotate all points back -
On 05/02/2013 at 13:03, xxxxxxxx wrote:
ehm, how do i rotate points? if it has to do with matrixes , i guess i am completely lost
-
On 05/02/2013 at 18:35, xxxxxxxx wrote:
Yes, it has to do with matrices. You can create the matrix very easily using HBPToMatrix() using the rotations used to rotate the object but negated (to go the other direction). Then you multiply the points (vertices) by the matrix.
Vector rot = obj->GetRelRot(); rot = -rot; Matrix rotmtx = HPBToMatrix(rot, ROTATIONORDER_DEFAULT); // Object obj must be a PointObject(PolygonObject) Vector* pts = obj->GetPoints(); if (!pts) return FALSE; LONG ptCnt = obj->GetPointCount(); for (LONG i = 0L; i != ptCnt; ++i) { pts[i] = pts[i] * rotmtx; }
-
On 05/02/2013 at 21:41, xxxxxxxx wrote:
thank you! i totally forgot about HBPToMatrix. and thank you for the snippet. that helped me alot
cheers,
ello