POV-Ray : Newsgroups : povray.newusers : Rotating triangle around middle point : Re: Rotating triangle around middle point Server Time
30 Jun 2024 03:39:11 EDT (-0400)
  Re: Rotating triangle around middle point  
From: Alain
Date: 12 Sep 2011 17:43:51
Message: <4e6e7d17@news.povray.org>

> Alain<aze### [at] qwertyorg>  wrote:
>>
>> 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 isotope
>> 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, shrink down, then
>> expand back to it's original size but with it's dimensions inverted.
>> In this case, you MUST ensure that clock NEVER reach exactly 0.5. This
>> will cause a scaling by zero which is undefined and will default to
>> scale 1 with a warning been issued.
>>
>>
>>
>> Alain
>
> 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.
>
>
>
>
>
>
>

For that, it may be beter to originaly create all your triangles along 

rotation around a single axis (Z, Y or X), then rotate and translate 
them to the desired final orientations and locations.

It may look more complicated, but, in the end can be much simpler to 
implement.

OR

You can go along with the proposition of Solar Mike and use:
Axis_Rotate_Trans(vcross(E-B, J-B), 180*clock)

You need to add:
#include "transforms.inc"
early in your scene to use that.


Other notes:
I don't recomend the use of finish{ambient 0.5} to make something 
brighter. This tend to flatten your shading and make you loose the 3D 
quality.
Increase the light's intensity instead, it's intensity is not limited to 
rgb<1,1,1>.

You can use another light, possibly coloured, to make shadowed parts 
brighter.

If you don't use transparency, use rgb<1,0,0> instead of rgbf<1,0,0,0>.
Here, also, the colour range is not limited to 0~1 range. Be carefull 
that you don't over saturate your colours and cause some clipping.

If your union only contains a single component, use object instead.

If all the components of an union share the same texture, apply that 
texture to the union as a whole and only give a texture to a component 
that have a different texture.



Alain


Post a reply to this message

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