POV-Ray : Newsgroups : povray.newusers : Add leaf on my tree : Re: Add leaf on my tree Server Time
30 Jul 2024 02:22:25 EDT (-0400)
  Re: Add leaf on my tree  
From: Tor Olav Kristensen
Date: 26 Oct 2004 20:23:00
Message: <417eea64$1@news.povray.org>
sap wrote:
> Hello;
> 
> I have made a tree macro and would like to add leaf on my tree. You can see 
> the result in the p.b.i.
...
>  #local ang=VAngle(p0,p1);
>  #local Np0=vrotate(p1,ang);
...

I have not looked at all of your code, but I spotted this:

In the code above you calculate an angle and then you rotate
a vector around all the x, y and z axes.

Is this intentionally ?

Note that:

   vrotate(p1, ang)

evaluates to:

   vrotate(p1, <ang, ang, ang>)

or equivalently:

   vrotate(p1, ang*x + ang*y + ang*z)

I.e. the p1 vector is first rotated around the x-axis, then
around the y-axis and finally around the z-axis.

Also: vrotate() expects its 2nd argument to be a vector with
components in degrees, while the angle returned from the
VAngle() macro is in radians.

(The VAngleD() macro will return an angle in degrees.)


You may want to read these sections once more:

http://www.povray.org/documentation/view/3.6.1/459/
---> 2.7.9.2 Vector functions and macros

http://www.povray.org/documentation/view/3.6.1/229/
---> 2.2.1.4.5 Functions


Also note that there is a built in function; vaxis_rotate(),
which will rotate a vector around an arbitrary vector.

-- 
Tor Olav
http://subcube.net
http://subcube.com


Post a reply to this message

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