POV-Ray : Newsgroups : povray.newusers : Rotating triangle around middle point : Re: Rotating triangle around middle point Server Time
30 Jun 2024 03:45:31 EDT (-0400)
  Re: Rotating triangle around middle point  
From: Alain
Date: 11 Sep 2011 18:23:06
Message: <4e6d34ca@news.povray.org>

> Hi, once again I've stumbled upon a problem. I have two triangles which are not
> parallel to any axis. I want it so that one of the triangles rotates around in
> place until it is pointing the opposite way of the other one, forming a
> hexagram.
> If I use scale -1, the triangle does go to it's opposite, but as soon as I put
> in a clock the "rotating" triangle shrinks and continues to grow in size
> pointing the opposite way all the time.
>
> example code for rotating triangle:
>
> #declare a =<1,1,0>;
> #declare b =<1,0,-1>;
> #declare c =<0,1,-1>;
>
> //moving
> triangle{ a, b, c
> pigment{rgbf<1,0,0,.5>}
> translate -a/3 translate -b/3 translate -c/3
> scale -1 * clock
> translate a/3 translate b/3 translate c/3
> }
>
> //stationary
> triangle{ a, b, c
> pigment{rgbf<1,1,0,.5>}
> }
>
> any help would be appreciated, thanks.
>
>
>
>

You correctly move your triangle around the origin, transform it, then 
translate it back in it's desired location. Good.

Your "scale -1*clock" (same as scale<-1,-1,-1>*clock) is an isotrope 
scaling. What you seems to want is a rotation of your triangle going 
from 0 to 180 degree over the course of your animation.
It may also be that you want your triangle to shrink down to almost 
nothing, then grow back as a reversed image of it's original shape.

First case, use rotate [axis]*clock*180

Second case, you need to adjust your scaling range. Sample:
scale 1-clock*2
This gives an effective range going from <1,1,1> to <-1,-1,-1>.

This will make your object start at it's full size, shring down, then 
expand back to it's original size but with it's dimentions inverted.
In this case, you MUST ensure that clock NEVER reatch exactly 0.5. This 
will cause a scaling by zero whitch is undefined and will default to 
scale 1 with a warning been isued.



Alain


Post a reply to this message

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