POV-Ray : Newsgroups : povray.newusers : Rotating triangle around middle point : Re: Rotating triangle around middle point Server Time
30 Jun 2024 03:37:44 EDT (-0400)
  Re: Rotating triangle around middle point  
From: Solar Mike
Date: 11 Sep 2011 23:55:00
Message: <web.4e6d81a5dbede6f8776f1f120@news.povray.org>
>
> Ok, I'll use
> rotate [axis]*clock*180
> , but I don't know how to find the axis.
> from the three points I made a 4th one which was the center of the 3, which the
> triangle is supposed to rotate on
>
> #declare a = <1,1,0>;
> #declare b = <1,0,-1>;
> #declare c = <0,1,-1>;
> #declare d = <2/3,2/3,-2/3>;
>
> but I don't know how to rotate it around and keep the 2 triangles coplanar.
>
> OK I'll stop "lying". I actually want to make an animation where an icosahedron
> has triangles which grow to a specified size, and rotate (on axis) 180 degrees
> during the growth.
> here is an example
>
> #declare B  = <0,1,-1.618>;
> #declare E  = <1,1.618,0>;
> #declare J  = <1.618,0,-1>;
>
> union{
> triangle{ B, E, J pigment{ rgbf<1,0,0,0>}    //colour and points
> translate -B/3 translate -E/3 translate -J/3 //translate to origin
> scale (14 + 6 * sqrt(5)) / 4 * clock         //specified resize
> rotate <0,0,0>                               //the part where it rotates 180 on
> the axis, need help on this
> translate B/3 translate E/3 translate J/3    //translate back
> finish{ambient 0.5}                          //brighter :P
> }
>
> so if you can please clarify the axis part, thanks.

I think you are just looking for the normal of the triangle right?  If so, you
can just use a cross product..
  Axis_Rotate_Trans(vcross(E-B, J-B), 180)

There may be a more elegant way but I think that will work.


Post a reply to this message

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