Re: Rotation of an IDLgrPolygon about a user specified axis [message #36756] |
Fri, 17 October 2003 08:44 |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
"Beat Schmutz" <Beat.Schmutz@flinders.edu.au> wrote in message
news:f40e34db.0310162138.2297ce29@posting.google.com...
> Dear all,
>
> If have generated an IDLgrPolygon model (200000+ vertices) of a bone.
> I have centred the data so that the model is displayed in the centre
> of the view/window. What I would like to do now is to rotate the model
> about the long axis of the bone. This axis passes roughly through the
> centre of the bone's shaft and will not lay in the middle of any of
> the xyz data ranges, otherwise I could just do
> oModel -> ROTATE. Once I have determined the equation of this axis
> (utilising data coordinates returned by 'pickData' in the draw_Event
> handler) how can I then rotate the model around this axis?
You need to translate the model so that the point you are rotating around is
at the origin, perform the rotation, and then translate it back.
For example, if I have a square with opposite corner coordinates: [30,30,0],
[50,50,0]
And I want to rotate the square about the Z axis at a point passing through
the middle of the square, then
oModel->Translate, -40, -40, 0
oModel->Rotate, [0,0,1], angle
oModel->Translate, 40, 40, 0
Karl
|
|
|