POV-Ray : Newsgroups : povray.newusers : Rotate Help Server Time
1 Nov 2024 00:23:50 EDT (-0400)
  Rotate Help (Message 1 to 3 of 3)  
From: Carl
Subject: Rotate Help
Date: 25 Sep 2011 15:15:00
Message: <web.4e7f7cb8d299d1538276e01c0@news.povray.org>
Ok... I'm doing something I've done many times before but for some reason things
aren't behaving as I expect.  I'm sure this is something stupid on my part but I
haven't found it yet.  Look at this code:

camera {location <-1,0,-1>*4 look_at <0,0,0> angle 12 up z right x}

#declare W1 = vnormalize(<-1,0,-1>);
#declare W1A = vaxis_rotate(W1,<1,0,-1>,10.3923*2/3);
#declare W2 = y;
#declare W3 = vaxis_rotate(W2,W1A,120);
#declare W4 = vaxis_rotate(W2,W1A,240);

cylinder {<0,0,0>,W1A*1.1,0.01 pigment{Green}}
cylinder {<0,0,0>,W1*1.1,0.01 pigment{Red}}

#declare Slidey = intersection {
  plane {-W2,-0.01}
  plane {-W3,-0.01}
  plane {-W4,-0.01}
  sphere {<0,0,0>,1 texture {pigment{Blue} finish{ambient 0}}}
}

object {Slidey}
object {Slidey rotate W1*180}

W1 is the axis you see end on here as the red dot:
http://wwwmwww.com/PovRay/test3.png

If you rotate 180 degress about this axis should I get a blue triangle pointed
down just below the red dot?

Let's replace the last line with
object {Slidey rotate W1A*60}

I'm now trying to rotate the blue shape by 60 degrees about the green axis.
I.e. the center of the triangle shouldn't move.  But it does.  Look here:
http://wwwmwww.com/PovRay/test2.png

Someone please tell me what I'm doing wrong.

Pulling my hair out...
Carl


Post a reply to this message

From: Carl
Subject: Re: Rotate Help
Date: 25 Sep 2011 15:35:01
Message: <web.4e7f822e65bb874e8276e01c0@news.povray.org>
Ok... I think I figured it out.  I need Axis_Rotate_Trans() not just rotate.

Thanks,
Carl


Post a reply to this message

From: Warp
Subject: Re: Rotate Help
Date: 25 Sep 2011 15:54:03
Message: <4e7f86db@news.povray.org>
Carl <car### [at] gmailcom> wrote:
> Ok... I think I figured it out.  I need Axis_Rotate_Trans() not just rotate.

If 'A' is a vector, then:

    rotate A

is simply a shortcut for:

    rotate <A.x, 0, 0>
    rotate <0, A.y, 0>
    rotate <0, 0, A.z>

which means "rotate A.x radians around the X axis, A.y radians around the
Y axis and A.z radians around the Z axis".

A vector in the form "<Value, 0, 0>" can also be written as "x * Value",
which literally means "<1, 0, 0> * Value", which is interpreted as
"<1 * Value, 0 * Value, 0 * Value>" (which naturally is "<Value, 0, 0>".
Thus it's common to write

    rotate Something * x

instead of

    rotate <Something, 0, 0>

because it's shorter. However, this shouldn't be confused as being some
kind of special syntax meaning "rotate by this many radians around this
axis", even though in this particular case the end result is that. If you
try any other "axis" it naturally won't work. For example:

    rotate Something * <1, 1, 0>

does not mean "rotate by Something radians around <1, 1, 0>". Instead as
said, it's just a shortcut for:

    rotate <Something, 0, 0>
    rotate <0, Something, 0>

or, in other words:

    rotate Something * x
    rotate Something * y

-- 
                                                          - Warp


Post a reply to this message

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