Re: A92: 3D rotation of plots


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

Re: A92: 3D rotation of plots




At 15:57 13/01/99 -0500, you wrote:
>
>Nathan Mueller on this list told me that you can rotate a plot m degrees
>around the z axis by doing the following:
>|cos(m)		sin(m)	0|	|x|
>|-sin(m)	cos(m)	0|*	|y|
>|0			0		1|	|z|
>
>now, how do you rotate a plot around the x and y axes? Thanks!
>--TurboSoft
>
>Visit the TurboSoft Homepage:  The most current Basic programs created by
>TurboSoft for the 89.
><A HREF="http://members.aol.com/turbosoft/turbosoft.html">
>http://members.aol.com/turbosoft/turbosoft.html
> 

You should use a 4x4 matrix. (like Direct3D) Why ? because
with a 3x3 matrix you can't make a translation.
Whereas with a 4x4 matrix :

[ 1  0 0  0]
[ 0  1 0  0]
[ 0  0 1  0]
[ tx ty tz 1]

rotation around x :

[ 1   0       0     0  ]
[ 0 cosa -sina   0 ]
[ 0 sina  cosa   0 ]
[ 0   0        0    1 ]

etc...

you can add the two matrix, and it will do a rotation and a translation
at the same time. powerful !!

Benoit SCHERRER


References: