POV-Ray : Newsgroups : povray.advanced-users : difficult questions (for me anyway) : Re: difficult questions (for me anyway) Server Time
30 Jul 2024 04:13:57 EDT (-0400)
  Re: difficult questions (for me anyway)  
From: Mike Williams
Date: 8 Mar 2000 15:20:01
Message: <pwldTMAYWrx4EwnE@econym.demon.co.uk>
Wasn't it Mick Hazelgrove who wrote:

>I make a second cylinder from this point to x*2 and rotate it
>randomly - does it rotate around zero or around the end point of cylinder
>one? If it rotates around zero how can I make it rotate around the end of
>cylinder one? do I have to translate it to zero, then rotate it, then
>translate it to the end of cylinder one?

You can get it to behave either way. You just have to configure things
right. If you want cylinder 2 to rotate about the end of cylinder 1,
then define them something like this:-


#declare Forearm = cylinder {0,x,...
  rotate <...>  // elbow
}

#declare WholeArm = union {
  cylinder {0,x,...}
  object {Forearm translate x}
  rotate <...>  // shoulder
}

The rotate instruction attached to Forearm rotates it about the elbow,
and the rotate instruction attached to WholeArm rotates the whole arm
about the shoulder keeping the elbow joint connected.

In general, the trick is to create the objects with the rotation point
at zero, apply the rotation, then perform the translation to where you
really want them later. In this way you can keep adding more sections to
the hierarchy and they'll all hang together and rotate correctly about
the joints you create.

-- 
Mike Williams * ##
Gentleman of Leisure


Post a reply to this message

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