POV-Ray : Newsgroups : povray.animations : Vectors POV : Re: Vectors POV Server Time
28 Jul 2024 18:17:22 EDT (-0400)
  Re: Vectors POV  
From: Josh English
Date: 31 May 1999 13:33:43
Message: <3752B9DC.FD94C4E2@spiritone.com>
Try this: (untested at this point)


#declare p = <anynumber,0,0>;
#declare v1 = anyvector;
#declare v2 = anyothervector;

#declare v3 = v2 - v1;
#declare v4 = vnormalize(v3);
#declare zrot = degrees(atan2(v4.y,v4.x));
#declare yrot = degrees(atan2(v4.z,v4.x));

#declare p2 = vrotate(p,<0,yrot,zrot>);

p2 should have the new position of the object

You also might want to check out John VanSickle's Matrix page at
http://www.erols.com/vansickl/matrix.htm

Joshua
eng### [at] spiritonecom


Nils Steinkamp wrote:
> 
> Hi there,
> 
> I have a little problem with the rotation of an object.
> 
> I have 2 points, < x1 , y1 , z1 > and < x2 , y2 , z2 > , and an object at
> the origin orientated in x-axis.
> Now I want to rotate the object that way that it has the same direction that
> the line from point 1 to point 2 has. The translation is done by other math,
> I only need to rotate the object about origin.
> 
> I tried much with vnormalize() and so on, but the results never looked like
> they should...
> 
> Thanks,
> 
> Nils
> 
> http://www.steini.de


Post a reply to this message

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