POV-Ray : Newsgroups : povray.general : Rotate list : Re: Rotate list Server Time
7 Aug 2024 11:24:10 EDT (-0400)
  Re: Rotate list  
From: Tom Bates
Date: 25 Nov 2001 04:25:29
Message: <3c00b909$1@news.povray.org>
Bill DeWitt wrote:
>
> "Tom Bates" <tho### [at] shawca> wrote :
> >
> > Bill, what kind of macros are these?
> >
> > Do they actually do the rotations, like this:
> >
> > #macro zxy(pz,px,py)
> >   rotate pz*z
> >   rotate px*x
> >   rotate py*y
> > #end
> >
> > object { MyObject
> >   zxy(30,45,-60)
> > }
>
>     Yes, almost exactly this. But I do it
>
> #macro zxy(ZEE, EKS, WHY)
>    rotate z*ZEE
>    rotate< EKS, WHY, 0>
> #end
>
>     ...which has the same effect.
>
> > Or, do they create a vector that can be used for the correct rotation,
> like
> > this:
> >
> > #macro zxy(pz,px,py)
> >   #local rx = ????;
> >   #local ry = ????;
> >   #local rz = ????;
> >   // I don't know what goes here, I'm working on it.
> >   <rx,ry,rz>
> > #end
> >
> > object { MyObject
> >   rotate zxy(30,45,-60)
> > }
> >
> > Obviously, the first one is easier to do, but the second one is what I'm
> > trying to figure out.
> >
> > Do you have some help for me?
>
>     Er... no... not off the top of my head, but I can see some benefit to
> that though. You can predefine rotations and then change them.
>
> #if (INT < VAR)
> #declare ROT = <30, 40, 50>;
> #else
> #declare ROT = zxy(30, 60, 90)
> #end
>
> object { OBJ rotate ROT }
>
>     I'll think about it and get back to you.
>

Bill DeWitt, you inspired me, and I did it.

I spent several more hours with Excel and paper and pencil (but
with more trig this time and less trial and error) and came up with
a nice, elegant solution.  I've posted "RotateList.inc" in p.b.s-f.

I used your notation, yxz(y,x,z), but in this case it will return a
single rotation vector that will result in the same rotation as if
you had used <0,y,0> then <x,0,z>.

It's used as a vector and can be assigned to a variable to be
used for a rotation later in the script.

Tom Bates.


Post a reply to this message

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