POV-Ray : Newsgroups : povray.newusers : problems rotating around arbitrary axis : Re: problems rotating around arbitrary axis Server Time
4 Nov 2024 21:23:21 EST (-0500)
  Re: problems rotating around arbitrary axis  
From: Mike Williams
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

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