Re: Rotating an object about several axis. confused
From: NeilUnreal (ptolemy_at_bellsouth.net)
Date: 07/20/04
- Next message: NeilUnreal: "Re: Rotating an object about several axis. confused"
- Previous message: d000hg: "RE: Meshes and vertex buffers"
- In reply to: Emil Astrom: "Re: Rotating an object about several axis. confused"
- Next in thread: NeilUnreal: "Re: Rotating an object about several axis. confused"
- Messages sorted by: [ date ] [ thread ]
Date: 20 Jul 2004 08:28:02 -0700
I think the problem would be made clearer by a broader sample from the
source code. I presume it looks something like:
D3DXMatrixRotationX (&matRotX, D3DXToRadian(45.0f));
D3DXMatrixRotationY (&matRotY, D3DXToRadian(45.0f));
Given the above, applying the net transform below to an object will
give the appearance of an object that has been first tilted on the
X-axis and then rotated (while tilted) on the Y-axis. In other words,
if the object is a tall rectangle, a flat face will still be facing
up, but the length of the rectangle will not be parallel to the
original X-axis.
matRotNet = matRotX * matRotY;
Doing the opposite multiplication will give the net appearance of an
object that has been first rotated on its Y-axis and then tilted
(while remaining rotated) on the X-axis. In other words, if the
object is a rectangle, the length of the rectangle will be parallel to
the original X-axis, but an edge will now be facing upwards.
matRotNet = matRotY * matRotX;
The second example is visually the same as doing the X-tilt and then
rotating the object along its transformed Y-axis, which is most often
what is desired when working with models of objects.
D3DXMatrixRotationYawPitchRoll
Does the transformations in Z, X, Y order.
Since most modeled objects fall into one of a few categories with
differing translation sequences, it makes sense to create classes
which apply the transforms correctly and then have the individual
object class instantiations reference these. This also makes it
easier to encapsulate common transformation subsets to prevent
re-computation, since several objects can reference the same base
transform.
-Neil
p.s. I apologize in advance if I misunderstood the original problem or
made any egregious math errors above; I still haven't finished my
morning coffee!
- Next message: NeilUnreal: "Re: Rotating an object about several axis. confused"
- Previous message: d000hg: "RE: Meshes and vertex buffers"
- In reply to: Emil Astrom: "Re: Rotating an object about several axis. confused"
- Next in thread: NeilUnreal: "Re: Rotating an object about several axis. confused"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|