POV-Ray : Newsgroups : povray.general : vaxis_rotate (A,B,F) ? : Re: vaxis_rotate (A,B,F) ? Server Time
10 Aug 2024 17:26:37 EDT (-0400)
  Re: vaxis_rotate (A,B,F) ?  
From: Peter Popov
Date: 19 Nov 1999 11:15:35
Message: <YHc1OIRNe5U8f+B8+RjQGAi3IAOc@4ax.com>
On Fri, 19 Nov 1999 09:41:30 -0400, "Robert Kirkpatrick"
<ill### [at] arinet> wrote:

>Greetings,
>
>    So I want to rotate an object  on an axis that I declare, without having
>to adjust for length. For instance I have an object that's called LeftArm.
>It is the union of two cylinders, and I would like to rotate it around the
>vector previously #declared as LeftShoulder.
>
>    From reading the Vector Functions Page of the help documentation, I
>think vaxis_rotate() will perform this for me, but I haven't been able to
>make it work . Unfortunately there are no examples on this topic that I
>could find.
>
>How can I do what I am trying to do? Could you give some working examples?
>
>Thanks so much,
>
>Robert

From John VanSickle's Matrix Page:

--------------------------------

Rotating around an arbitrary axis: The standard rotate transform
rotates around the x, y, and z axes. It is possible, however, for the
axis of rotation to lie along any vector, and not just the major axes.
The vaxis_rotate(A,B,f) function allows you to rotate a point around
any axis, but there is no standard transform for such an operation on
an object. A couple of properly-designed matrices and a snippet of
scene code will do the trick:


  #local VX = vnormalize(V); // assuming that V is the axis of
rotation
  #local VY = vnormalize(vcross(VX,<VX.y,VX.z,-VX.x>));
  #local VZ = vnormalize(vcross(VX,VY));

  object { MyObject
    matrix < VX.x,VY.x,VZ.x,
             VX.y,VY.y,VZ.y,
             VX.z,VY.z,VZ.z,
                0,   0,   0 >

    rotate x*Angle // here Angle is your angle of rotation

    matrix < VX.x,VX.y,VX.z,
             VY.x,VY.y,VY.z,
             VZ.x,VZ.y,VZ.z,
                0,   0,   0 >
  }

--------------------------------

I hope this is what you're looking for.


Peter Popov
ICQ: 15002700


Post a reply to this message

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