rotate polygon
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/11/2002 at 09:48, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.012
Platform: Windows ;
Language(s) : C++ ;---------
How can I rotate a polygon? I tried rotate its three (or four) points but I can´t make them rotate in a circle. I tried to add a vector like 0,0,1 and then check if the distance to the midpoint is still the same. And then check the other two (or three) points if they have the same distance to each other so they would rotate around the midpoint too. But it seems to be wrong or I cannot make it.
(for the first point) :
vadr[i] += Vector(0,0,1);
vadr[i] = (distance_to_midpoint/Len(vadr[i]))*vadr[i];
Anybody know how to correctly rotate a polygon?
Thanks in advance
Samir -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/11/2002 at 10:00, xxxxxxxx wrote:
Use a rotation matrix:
Vector center; Vector axis; Real angle; Matrix rot = MatrixMove(center) * RotAxisToMatrix(axis, angle) * !MatrixMove(center); vadr[i] *= rot;
The above first centers the points around the origin, then rotates them by angle around axis and finally moves them back. All in one accumulated matrix operation.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/11/2002 at 10:06, xxxxxxxx wrote:
Upps, that was fast! Thanks very much. I have read this technique in my first book about 3D, the chapters name was "Basic knowledge". I guess I gotta go back to the basics. I have to face more Matrix work I guess.
Best
Samir