Re: Rotation problem



You need to get some preliminaries out of the way before you worry about
this. Forget about using glRotate, as it's practically worthless since
you're going to have to be able to rotate your own vertices within your
model at some point. Learn to do your rotations via direct matrix
manipulation.

Don't bother with quaternions, either, as they don't gain you anything over
matrices and are just extra work for something that matrices already do.
Quaternions are good ONLY for rotation, while matrices are good for
rotation, translation, scaling, and shearing. Any rotational benefits
quaterions provide are lost with the need to convert back to matrices. I
found the ArcBall algorithm to be needlessly obtuse, and a pointless
exercise which seems to exist largely as an excuse to use quaternions.

Get a small book on Linear Algebra and learn basic matrix math. There are
books that concentrate solely on matrix math that are fairly cheap. Spend
a week or two getting familiar with it (it's not very hard), then find a
web site that covers matrix rotation around an arbitrary axis. This is the
end result you are after. You can skip to this last part right away and
just copy the code you find on the web if you're impatient, but you'll get
further if you understand the matrix structure as it relates to 3D graphics
(again, it's not hard) and how to perform basic matrix operations (such as
multiplying a matrix and a vector).

Once you have the ability to rotate around an arbitrary axis, rotating a
model in place via the mouse is easy. Essentially, you'll just calculate
how far the mouse has moved in both the X and Y directions, construct an
axis perpendicular to the plane formed by those differences, and rotate
your object around that axis by the length of the mouse motion. There are
tweaks for rotational speed, but those will come to you naturally once
you've reached this point.

As tempting as it seems, don't try to shortcut the learning process. Do
your linear algebra homework, and most of this will be much easier down the
road.

antianti@xxxxxxxxxxxxxx wrote:

Can someone explain how I can do this rotation
properly? Do I need to change the view point?

Thanks.

.



Relevant Pages

  • Re: Rotation
    ... I don't understand quaternions, and I'm trying to only use code that I ... I think the key point for rotations is that you have to rotate ... When you construct a pure rotation matrix, ... Where C is the center point and theta, phi and gamma are your angles ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Rotation
    ... I think a lot of people would just store the object's orientation in a ... I don't understand quaternions, and I'm trying to only use code that I ... I think the key point for rotations is that you have to rotate ... When you construct a pure rotation matrix, ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Quaternions and the stock market
    ... Show the rotation for A in terms of floating point ... I though the whole point of using quaternions ... Rotating about an arbitrary axis avoids gimbal lock. ...
    (sci.math)
  • Re: newbie: rotating meshes
    ... If I understand what you are trying to do correctly, what you want is to use quaternions. ... Quaternions allow you to do a rotation about an arbitrary axis in 3d space. ... >> Trying to rotate after a translation will stop the effect where it looks ... Second let's say I have some kind of ship, ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Camera Management
    ... and rotate the original forward/up ... > vectors by that angle, rather than rotating the already rotated vectors ... A large number of problems arose when I tried maintaining rotation angles ... Matrices are many times simpler to use, and Quaternions have to ...
    (comp.graphics.api.opengl)