POV-Ray : Newsgroups : povray.general : Rotate list : Re: Rotate list Server Time
7 Aug 2024 11:20:55 EDT (-0400)
  Re: Rotate list  
From: Tom Bates
Date: 24 Nov 2001 12:23:02
Message: <3bffd776@news.povray.org>
Bill DeWitt <bde### [at] cflrrcom> wrote in message
news:3bff99d0$1@news.povray.org...
>
> "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.
>
>

The reason I ask is that I'm developing a macro model of a creature that
takes two include files as parameters, one for genetics parameters (which
defines the size and shape of the creature), and one for position parameters
(which defines the position and expression for the creature).

It is used like this:

#include "Creature.pov"

object { Creature("Human1.inc", "Human_Walking.inc" )
  rotate <0,-120,0>
  translate <0.30,1.93,14.00>*m
}


And the position file is like this:

  // ...
  #declare RAHR   = <   0, -90,   0>;   //  Right Arm Hand Rotation
  #declare RAER   = <   0,   0, 120>;   //  Right Arm Elbow Rotation
  #declare RASR   = < -90, -45,   0>;   //  Right Arm Shoulder Rotation
  // ...

When I was trying to close a thumb around a closed fist, the rotations I
wanted for the base of the thumb were: 90*y, 30*z, 45*x.  I played with
matrices in MS-Excel for a couple of hours (some linear math, some trig,
some geometry, some trial and error) to come up with <60,45,90> that did the
same rotation.

instead of this,

  #declare RHF1A1 = <  60,  45,  90>;   //  Right Hand Finger 1 Angle 1

I would have loved to be able to do this (using your notation, which I think
is next to perfect, btw):

  #declare RHF1A1 = yzx(  90,  30,  45);   //  Right Hand Finger 1 Angle 1


Would anyone be able/willing to help me with the math for the general
rotation conversion macros that I need?

Thanks,

Tom Bates.


Post a reply to this message

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