POV-Ray : Newsgroups : povray.general : Rotation around an axis at the origin Server Time
7 Aug 2024 17:27:31 EDT (-0400)
  Rotation around an axis at the origin (Message 1 to 9 of 9)  
From: Jérôme Grimbert
Subject: Rotation around an axis at the origin
Date: 4 Jul 2001 15:50:44
Message: <3B43739B.305A5FF6@free.fr>
I have a question that I'm currently failing to resolve,
so any help is welcome:

What is the form of the transformation matrix that would
perform a rotation of a given angle (alpha), at the origin
(<0,0,0>), around any possible axis (<a,b,c>).

I know the form for a rotation around the X, Y or Z,
but I just cannot figure how to do it for any vector as
the axis of the rotation.
If it can help, it can be assumed that the length of the vector 
is the unit (or whatever please the solver).

I hope for a solution that is expressed in term of: 
 -the vector which is the normal to the plane of the rotation,
 -the angle of the rotation, as measured in the plane of the rotation

Thanks in advance.


Post a reply to this message

From: Rune
Subject: Re: Rotation around an axis at the origin
Date: 4 Jul 2001 16:49:43
Message: <3b438167@news.povray.org>
So you want a rotation that is for objects what vaxis_rotate() is for
vectors?

Just do a vaxis_rotate of <1,0,0>, one of <0,1,0> and one of <0,0,1> and use
the resulting vectors for the first 9 values in the matrix. The last 3
values are 0, 0, 0.

However, I'm not sure if that's what you asked for, or if you need the
actual formulae (which I don't know).

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

From: Alberto
Subject: Re: Rotation around an axis at the origin
Date: 4 Jul 2001 20:41:19
Message: <3B43B749.3F49E27D@usb.ve>
Take a look at

http://www.ma.usb.ve/~jacob/povgraph/rot1.html

Hope this will help you.

Regards, Alberto.


Post a reply to this message

From: John VanSickle
Subject: Re: Rotation around an axis at the origin
Date: 6 Jul 2001 14:47:06
Message: <3B460965.13FAD3F3@erols.com>

> 
> I have a question that I'm currently failing to resolve,
> so any help is welcome:
> 
> What is the form of the transformation matrix that would
> perform a rotation of a given angle (alpha), at the origin
> (<0,0,0>), around any possible axis (<a,b,c>).
> 
> I know the form for a rotation around the X, Y or Z,
> but I just cannot figure how to do it for any vector as
> the axis of the rotation.
> If it can help, it can be assumed that the length of the vector
> is the unit (or whatever please the solver).
> 
> I hope for a solution that is expressed in term of:
>  -the vector which is the normal to the plane of the rotation,
>  -the angle of the rotation, as measured in the plane of the rotation

Matrix Man to the rescue!

http://enphilistor.users4.50megs.com/matrix.htm

Regards,
John
-- 
ICQ: 46085459


Post a reply to this message

From: Jérôme Grimbert
Subject: Re: Rotation around an axis at the origin
Date: 7 Jul 2001 13:38:01
Message: <3B4729F3.46383ADD@free.fr>
Rune wrote:
> 
> 
> However, I'm not sure if that's what you asked for, or if you need the
> actual formulae (which I don't know).
> 

I needed the actual formulae.
But thanks for the hint, I will search in Megapov sources.


Post a reply to this message

From: Jérôme Grimbert
Subject: Re: Rotation around an axis at the origin
Date: 7 Jul 2001 13:38:02
Message: <3B472A65.3D1F4DC6@free.fr>
Alberto wrote:
> 
> Take a look at
> 
> http://www.ma.usb.ve/~jacob/povgraph/rot1.html
> 

Good !
I computed the product of 5 rotation matrix
(2 change of base, actual rotation by the angle, and back to
the original base with the transpose of the two first) but
I ended up with a rather strange diagonal (the first term
was like a1.a1+(a1.a1.a2.a2+a3.a3)/(a1.a1+a3.a3)*cos(alpha),
when a1 and a3 not null, otherwise a1.a1+cos(alpha) ;
the third on the diagonal was similar, while the
second was a2.a2+(a1.a1+a3.a3)*cos(alpha), so I was not
really sure if I hadn't done something wrong.

I really prefer your suggestion.
(Note: I found the same formulaes for the non-diagonal factors,
so, I must not been so wrong, afterall)

P.S: I just look also in megapov source, it has the same formulae.


Post a reply to this message

From: Alberto
Subject: Re: Rotation around an axis at the origin
Date: 7 Jul 2001 16:03:43
Message: <3B476AB8.EF0FF378@usb.ve>
Glad it helped you.

Once you find how to rotate a vector around an axis, the rows of the
matrix are the rotation of the vectors x, y and z. Here is a shorter
code for the matrix

#macro matrot(axis ang)
  #local mv = vnormalize(axis); #local ma = radians(ang);
  #local a1 = mv.x;    #local a2 = mv.y;    #local a3 = mv.z;
  #local sa = sin(ma); #local ca = cos(ma); #local dc = 1 - ca;
  matrix <
    a1*a1*dc + ca,    a1*a2*dc + sa*a3, a1*a3*dc - sa*a2, 
    a2*a1*dc - sa*a3, a2*a2*dc + ca,    a2*a3*dc + sa*a1, 
    a3*a1*dc + sa*a2, a3*a2*dc - sa*a1, a3*a3*dc + ca, 
    0, 0, 0
  >
#end

Alberto.


Post a reply to this message

From: Greg Smith
Subject: Re: Rotation around an axis at the origin
Date: 16 Jul 2001 21:17:45
Message: <3B539223.E15563D9@alumni.uwaterloo.ca>
Hey, I suggested this as a new feature a few years back.

rotate_unform <rot_vector>
   -or-
rotate_uniform angle*<normal>

rotates about the given vector, by an angle equal to the magnitude
of the vector.

The usefulness of this is that rotations interpolate much better
in this space. If you have an animation and you describe rotations
at keyframes by this means, interpolations between the keyframes
based on interpolations in the rotation vector space work much better
since the space is uniform (except for rotation close to 180 degrees).
With the standard rotation, you can get weird effects if the interpolation
path happens to come close to the 'north pole' if you see what I mean.

I see other have helped you with this already....



> I have a question that I'm currently failing to resolve,
> so any help is welcome:
>
> What is the form of the transformation matrix that would
> perform a rotation of a given angle (alpha), at the origin
> (<0,0,0>), around any possible axis (<a,b,c>).
>
> I know the form for a rotation around the X, Y or Z,
> but I just cannot figure how to do it for any vector as
> the axis of the rotation.
> If it can help, it can be assumed that the length of the vector
> is the unit (or whatever please the solver).
>
> I hope for a solution that is expressed in term of:
>  -the vector which is the normal to the plane of the rotation,
>  -the angle of the rotation, as measured in the plane of the rotation
>
> Thanks in advance.


Post a reply to this message

From: Jérôme Grimbert
Subject: Re: Rotation around an axis at the origin
Date: 17 Jul 2001 17:12:25
Message: <3B54A98A.D77B3945@free.fr>
Greg Smith wrote:
> 
> Hey, I suggested this as a new feature a few years back.
> 
> rotate_unform <rot_vector>
>    -or-
> rotate_uniform angle*<normal>
> 
> rotates about the given vector, by an angle equal to the magnitude
> of the vector.
> 
> The usefulness of this is that rotations interpolate much better
> in this space. If you have an animation and you describe rotations
> at keyframes by this means, interpolations between the keyframes
> based on interpolations in the rotation vector space work much better
> since the space is uniform (except for rotation close to 180 degrees).
> With the standard rotation, you can get weird effects if the interpolation
> path happens to come close to the 'north pole' if you see what I mean.
> 
> I see other have helped you with this already....

rotate_uniform would not have solved my purpose, because
the angle is different for each point of the original object
(for screwing, it is proportional to the projection on the axis,
for rolling, it is proportional to the distance to the axis), so
I really needed the formulae (I compute a full matrix for each point now !)

May I suggest, nevertheless, that you find a more 'simpler' term,
if you expect this extension to enter any release.
I would suggest something like 'turn' 
(as 'turn' around <x,y,z> axis, like 'rotate' by <x,y,z> degres )
Or try any single word which may be a synonym for 'rotate'.


Post a reply to this message

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