POV-Ray : Newsgroups : povray.newusers : problems rotating around arbitrary axis Server Time
4 Nov 2024 23:21:24 EST (-0500)
  problems rotating around arbitrary axis (Message 1 to 3 of 3)  
From: Kaveh
Subject: problems rotating around arbitrary axis
Date: 24 Nov 2002 00:36:02
Message: <1fm5fwi.sbrq6ce5gd98N%kaveh@delete_this.focalimage.com>
I am trying to rotate an object around an axis, using, for example, this
code:

---------------
#declare myvector <1,0,1>;

object{myobject rotate 45*vnormalize(myvector)}
---------------

But the rotation is not around the vector specified. It works fine for
x,y, etc, but around other vectors it doesn't give the expected result.

I tried a loop with a range of rotations, to see the trajectory, and it
is not a circle, but some kind of cusp shape.

Is there something basic I am doing wrong?
-- 
Kaveh


Post a reply to this message

From: Mike Williams
Subject: Re: problems rotating around arbitrary axis
Date: 24 Nov 2002 01:34:23
Message: <28XawAA2KH49Ew52@econym.demon.co.uk>
Wasn't it Kaveh who wrote:
>I am trying to rotate an object around an axis, using, for example, this
>code:
>
>---------------
>#declare myvector <1,0,1>;
>
>object{myobject rotate 45*vnormalize(myvector)}
>---------------
>
>But the rotation is not around the vector specified. It works fine for
>x,y, etc, but around other vectors it doesn't give the expected result.
>
>I tried a loop with a range of rotations, to see the trajectory, and it
>is not a circle, but some kind of cusp shape.
>
>Is there something basic I am doing wrong?

What's happening is that the expression that follows the "rotate"
keyword isn't the axis vector times the rotation amount. It's a sequence
of three separate rotations around the x, y and z axes, and that doesn't
happen to be the same thing in most cases.

What you want to do is

        #include "transforms.inc"
        object {myobject transform {Axis_Roatate_Trans (myvector, 45)}}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Kaveh
Subject: Re: problems rotating around arbitrary axis
Date: 24 Nov 2002 03:10:37
Message: <1fm5jjf.1dv0gjojwixvkN%kaveh@delete_this.focalimage.com>
Mike Williams <mik### [at] econymdemoncouk> wrote:

> What's happening is that the expression that follows the "rotate"
> keyword isn't the axis vector times the rotation amount. It's a sequence
> of three separate rotations around the x, y and z axes, and that doesn't
> happen to be the same thing in most cases.
> 
> What you want to do is
> 
>         #include "transforms.inc"
>         object {myobject transform {Axis_Roatate_Trans (myvector, 45)}}

Thanks Mike. Silly of me!!

-- 
Kaveh


Post a reply to this message

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