|
![](/i/fill.gif) |
Les Patterson <les### [at] txcyber com> wrote:
: There's something I don't understand about rotation.
: In the case of an aircraft positioned at 0,0,0(facing camera) then X,
: and Z work fine, but rotate the aircraft to a right angle to the camera,
: 0,-90,0 and then X & Z don't rotate as expected. I understand that this
: is a 360degree universe, but if that's the case then why wouldn't the
: rotational angles be the same regardless of which direction the aircraft
: is pointing?
If you tell povray to rotate an object around the x-axis, it will rotate
the object around the x axis. There's no reason for it to rotate it around
any other axis. It rotates the object around the x-axis regardless of the
current orientation of the object.
Also you have to understand that the effect of consecutive rotations are
summed in the order they are given. This means that if you do this:
rotate <50,0,0>
rotate <30,0,0>
the final orientation of the object will be equivalent to
rotate <80,0,0>
Now, with these two things in mind, think about these consecutive rotations:
rotate <0,45,0>
rotate <45,0,0>
rotate <0,-45,0>
rotate <-45,0,0>
It might not be clear at first, but the net effect of those rotations
is *not* as if no rotations were made at all.
Suppose we have a regular box { -1,1 } which we are rotating that way.
First we rotate it 45 degrees around the y-axis. Now the face which was
facing the camera is oriented so that it's 45 degrees to the left (the side
of the box which was facing right is now 45 degrees to the right).
Then we rotate 45 degrees around the x-axis. Here it's important to
understand that the rotation is done around the x-axis, not any other axis.
The cube is rotated so that now we see three of its faces (the new face is
the lower face which became visible). The corner of the box is pointing
approximately at the camera.
The next rotation is more difficult to imagine in our head (thus it's
better to do it in povray to see it). We rotate -45 degrees around the y-axis.
The box is rotate so that the corner which was pointing at the camera now
points 45 degrees to the right. We still see the lower face and the original
front face of the box, but it's tilted
Finally we rotate -45 degrees around the x-axis. The final orientation
of the box looks awkward because it still is tilted. It's oriented
approximately so that the original front face of the box is again facing
the camera, but the whole box is tilted.
I know that this is pretty confusing, but it's a direct consequence of
the fact that rotations are always made around the axes. You should test
with the box example to see what happens. Here's a simple scene:
camera { location -z*7 look_at 0 angle 35 }
light_source { <100,200,-300>, 1 }
box
{ -1,1 pigment { rgb <1,.5,0> }
rotate <0,45,0>
rotate <45,0,0>
rotate <0,-45,0>
rotate <-45,0,0>
}
Note that the order of the rotations matter. If we shuffle the rotations
above, we will get a different result.
With your aircraft you have to make the rotations in the right order
to get the correct result. You probably want to rotate first around the
main longitudinal axis of the plane, then around the "pitch" axis and then
the axis which orients the plane to wherever it is heading.
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
![](/i/fill.gif) |