POV-Ray : Newsgroups : povray.general : Like flower turn to the sun Server Time
29 Jul 2024 08:14:19 EDT (-0400)
  Like flower turn to the sun (Message 1 to 6 of 6)  
From: Albun
Subject: Like flower turn to the sun
Date: 30 Nov 2012 16:20:02
Message: <web.50b921f63ac718a08505b26b0@news.povray.org>
Well, it's mathematical problem about orientation of box, in this exemple.
The box are positionned along an array-point,
but they are all in one orientation.

My question is :
how can I oriented each box in a direction, around one point_orientation, like
flower turn to the sun.




////////
#declare Dim_Camp =dimension_size( camp,1 );


union{
// outer loop -------------------
 #declare NrX = 1;  // start x

 #while (NrX< Dim_Camp)


box{<-1.5,0,-.5>,<1.5,1,.5> pigment{Red} scale 2 rotate <0,0,0> translate
camp[NrX]  }


 #declare NrX = NrX + 1;  // next Nr x
 #end // --------------- end of loop x
// end of outer loop



Thanks


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Like flower turn to the sun
Date: 30 Nov 2012 22:24:23
Message: <50b97867@news.povray.org>
Albun wrote:

> Well, it's mathematical problem about orientation of box, in this exemple.
> The box are positionned along an array-point,
> but they are all in one orientation.

if your positions are random or follow some regular formula you
may be able to reverse the problem: Do not calculate the positions
of your boxes in x/y/z and then figure out how they should be oriented.
Instead, describe the desired position by their distance from the point
of interest and the angle how it should be rotated. Assume the point of
interest is at the origin, which is also the initial location of each
box object. Move each objects to its desired distance (e.g. translate
D*y), then rotate them to the desired position. They will keep their
orientation facing the origin no matter where you move them.

Otherwise, you need to calculate spherical coordinates of the box
positions with respect to the sphere around the point of interest.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Like flower turn to the sun
Date: 1 Dec 2012 03:10:02
Message: <50b9bb5a@news.povray.org>
On 30-11-2012 22:16, Albun wrote:
>
> Well, it's mathematical problem about orientation of box, in this exemple.
> The box are positionned along an array-point,
> but they are all in one orientation.
>
> My question is :
> how can I oriented each box in a direction, around one point_orientation, like
> flower turn to the sun.
>

Maybe I am wrong, but have you tried  Point_At_Trans()  or 
Reorient_Trans()  from transforms.inc?

Thomas


Post a reply to this message

From: Albun
Subject: Re: Like flower turn to the sun
Date: 1 Dec 2012 10:15:00
Message: <web.50ba1eda8fa326b21e902e140@news.povray.org>
;-) The Sun don't shining enought to turn flower.

1)I don't understand how calculate distance, without move directly to the
array_point that i have.
There is VDist(V1,V2), but what else with angle VAngleD(V1,V2)?

2)In my exemple the Sun, not origin, is at <3,0,54>.
With "transform.inc", i adjust code like that after translate with the forth.
but no result.



//

 translate camp[NrX]             // go to the point

 //Point_At_Trans(<3,0,54>)

 //Reorient_Trans(<0,0,0> ,<3,0,54>)

 //rotate <0,0,VRotationD(camp[NrX],<3,0,54>,<0,0,0>)>

 // rotate <0,0,VAngleD(<0,0,0>,camp[NrX])>


/// Flowers love rock 'n roll, but don't like valse of Sun.


anything else...


Post a reply to this message

From: Thomas de Groot
Subject: Re: Like flower turn to the sun
Date: 2 Dec 2012 03:01:51
Message: <50bb0aef$1@news.povray.org>
On 1-12-2012 16:14, Albun wrote:
> ;-) The Sun don't shining enought to turn flower.
>
> 1)I don't understand how calculate distance, without move directly to the
> array_point that i have.
> There is VDist(V1,V2), but what else with angle VAngleD(V1,V2)?
>
> 2)In my exemple the Sun, not origin, is at <3,0,54>.
> With "transform.inc", i adjust code like that after translate with the forth.
> but no result.
>

You have always to work from the origin and translate to the correct 
position later. Here is an example:

//Use of Point_At_Trans:
#declare Cyl =
union {
   cylinder { <0, 0, 0>, <0, 1, 0>, 0.05
     pigment {color rgb <1, 0, 0>}
   }
   sphere {0, 0.15 pigment {rgb <0, 1, 0>}}
}

#declare TargetObj =  sphere {0, 0.15 pigment {rgb <1, 1, 1>}}

//points at Target
#declare Target = <0, 1.5, 10>;
#declare CylPos = <1, 0, 1>;
#declare YAxis  = Target - CylPos;

object {Cyl
   Point_At_Trans(YAxis)
   translate CylPos
}

object {TargetObj translate Target}



Thomas


Post a reply to this message

From: Albun
Subject: Re: Like flower turn to the sun
Date: 2 Dec 2012 07:05:00
Message: <web.50bb43908fa326b2406edc630@news.povray.org>
ok, the weather is good, and flower turning to the Sun

Here is my lines with array_point



#include "point.inc"

#declare Dim_Camp =dimension_size( camp,1 );

 //Use of Point_At_Trans:
#declare obj_var =
box{<-1.5,0,-.5>,<1.5,1,.5> pigment{Red} scale 2
}

#declare TargetObj =  sphere {0, 2 pigment {rgb <.5, 0, 1>}} //sun



//loop

 #declare Nrloop = 1;  // start loop

 #while (Nrloop< Dim_Camp)

//points at Target
#declare Target = <3,0,54>;   //sun center
#declare obj_varPos = camp[Nrloop];
#declare YAxis  = Target - obj_varPos;

object {obj_var

        // rotate <0,0,90>
   Point_At_Trans(YAxis)
   translate obj_varPos
}

//object {TargetObj translate Target}

#declare Nrloop = Nrloop + 1;  // next Nr loop
 #end // --------------- end of loop
// end of outer loop


Thanks  a lot...


Post a reply to this message

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