gnu3dkit-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu3dkit-discuss] hpr or phr??


From: Philippe C.D. Robert
Subject: Re: [Gnu3dkit-discuss] hpr or phr??
Date: Sat, 13 Jul 2002 22:55:20 +0200

Hi,

On Friday, July 12, 2002, at 06:43 PM, Brent Gulanowski wrote:
Well, I'm only one node (a shape) deep right now (technically two nodes, but the immediate node above, the world's static group, has the default transformation matrix). I believe that means that there is only one matrix being applied, and its aspects are totally dependent on the shape's G3DTransform. At least, that's the only entry point to the shape's orientation that I can find.

That's correct, if you ignore the camera matrix.

Ignoring the confusion of model and view matrices as introduced below (and ignoring translations), I am simply trying to rotate (roll) my shape around the three cardinal axes, with the shape's "front" facing in either the positive or negative direction. Mentally I would first face it down the correct axis (with either a heading change, for +/-X or -Z, or a pitch change, for +/-Y) and then apply a roll around the shapes new relative Z axis.

Example: think of, say, a stop sign occupying {(0,0,0), (1,0,0), (1,1,0), (0,1,0)} and facing down the global positive Z-axis. It doesn't matter where the viewer is, I don't think.

Now say I want it to face in the -Y direction with the word "STOP" having a relative up in the -X direction. Then it would occupy {(0,0,0), (0,0,1), (-1,0,1), (-1,0,0)}. ("UP" is parallel to the line between the second and third points).

I would imagine doing this with two rotations: pitch 90 + roll 90. But that doesn't work. If I do that, I get this: {(0,0,0), (0,1,0), (0,1,1), (0,0,1)}: facing in the +X direction, "Up" in the +Z direction...

What are you doing exactly, how does your code look like? Always take in account the order of matrix operations.

Oh, now I see. the successive rotations *are* localized, but the rotations are

localized???

being applied in the reverse of the order I thought they should be. Why do I have it wrong? Using my test features, I see that the pitch is applied after the roll and relative to the local X axis.

Uhm, what's your question exactly? If you have problems understanding what HPR is, there are many books and articles describing its theory out there.

OK, whatever my previous misconceptions, I think I can make this work now.

It's really not that hard!

The problem here is that GL uses a modeview matrix whereas the model and the view is not really the same thing. Have a look at the G3DCamera class to see how this works.

OK, I'll do that. Perhaps now is the time to switch from manually orienting my view to using the provided class. Will that have any impact on what I'm talking about above, though? I mean, I was totally wrong that I was working in global co-ordinates anyway.

You mean using the G3DCamera class? This should not have any impacts on what you are doing on the scene.

-Phil
--
Philippe C.D. Robert
http://www.nice.ch/~phip




reply via email to

[Prev in Thread] Current Thread [Next in Thread]