POV-Ray : Newsgroups : povray.advanced-users : Rotation mathematics : Re: Rotation mathematics Server Time
29 Jul 2024 20:22:53 EDT (-0400)
  Re: Rotation mathematics  
From: Chris Colefax
Date: 10 Jan 2001 18:52:06
Message: <3a5cf5a6@news.povray.org>
Simon Lemieux <lem### [at] yahoocom> wrote:
>   just finished my session and learned quite a few interesting things...
such as
> 2D rotations, where in radians (0 <= r <= 2pi):
> x = cos(rad);
> y = sin(rad);
>
> Now, I was wondering how to add the Z coordinate? Is it possible? I guess
a
> better use would be to have different angles, rotating around a given axis
and
> use the cos&sin functions just like for x&y but substituting x&z for a
yAxis
> rotation, etc...
>
> Is there any better math out there to help about rotations? Except for
> matrixes...

All transformations in POV-Ray are ultimately represented as matrices,
because they offer the most general and compact form of the transformations
available in POV-Ray.  But POV-script is designed to be written and read by
people, not just computers, and the rotate, translate and scale commands
offer a much more intuitive way of performing transformations.  In other
words, don't feel obliged to learn matrices if the other three functions
allow you to do what you wish.

Regarding rotations - they are indeed performed, like you describe, as 2D
rotations about each of the three orthogonal axes, x, y, and z.  For
example, rotate <40, -20, 165> is interpreted as rotating 40 degrees about
the x-axis, followed by -20 degrees around the y-axis, followed by 165
degrees around the z-axis.  If you want to rotate around the y-axis, then
around the x-axis, you have to use two rotate commands, e.g. rotate y*45
rotate x*-90.

Another common method of expressing rotations in 3D space are quaternions -
these are rotations around arbitratry axes, rather than just the x, y, and z
axes.  For example, you might want to spin an object around the diagonal
axis <1, 1, 1>.  Quaternions are often used when interpolating objects from
one orientation to another, as they provide a smoother result than limiting
yourself to the x, y, and z rotational axes.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.