Re: Rotating an object about several axis. confused

From: NeilUnreal (ptolemy_at_bellsouth.net)
Date: 07/20/04


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!



Relevant Pages

  • Re: ifs image width and height
    ... Is there some way to predict the width and height of an IFS attractor? ... My programs generating IFS images always make some iterations to store ... Sometimes you can find an extremum by repeatedly tranforming using one transform, but this doesn't necessarily work when rotations and reflections are involved. ... Transform the four corners of this rectangle with each transform, and find the smallest rectangle which includes all the points so obtained. ...
    (sci.fractals)
  • Re: Zoom relative to mouse position
    ... the rectangle is rendered upright on the screen ... how the rectangle remains upright ... and how it is positioned (due to the tx transform). ... home dot woh dot rr dot com slash jbmatthews ...
    (comp.lang.java.programmer)
  • Re: Finding End Points for a skewed/rotated Ellipse drawn with GraphicsPath
    ... right endpoints happen to fall in the middle of the the rectangle on the ... In fact, if I read the points out of the GraphicsPath, ... whatever formula to determine how the ellipse will look. ... And then comment out the transform, ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Correcting Photographs of Paintings
    ... object a rectangle which I can then crop to get a clean image. ... You can use the Perspective tool from the toolbar or press Shift-P. ... (anything outside the grid will be trimmed). ... the Transform dialog, the photo will be fixed so it is square. ...
    (comp.graphics.apps.gimp)

Quantcast