POV-Ray : Newsgroups : povray.general : lining up an object with a vector Server Time
6 Nov 2024 06:21:27 EST (-0500)
  lining up an object with a vector (Message 1 to 3 of 3)  
From: Jan Maarten van der Valk
Subject: lining up an object with a vector
Date: 3 Oct 2002 04:45:58
Message: <3d9c03c6@news.povray.org>
Hi all.
How can I rotate an object so that it's up-coordination <0,1,0> lines up with a
given vector?

JM

--
#macro J(M)V()<V(),V(),V()>#if(M)J(M)#end#end#local _=20;#macro V()asc(substr
("IIMYKIIYMMKQOIMYQEEYSCEYUEGQWEHYYIGQ[HEY]IGY_JGQaJEYcKGYeKGQgLEYiMKIs#K ",
73-M,1))/2-36.5#declare M=M-1;#end#local a=spline{cubic_spline J(72)}#while
(_)sphere{a(_).1pigment{rgb(a(_)+(x+y)*3.5)}}#local _=_-.02;#end//JM


Post a reply to this message


Attachments:
Download 'Jan Maarten van der Valk.vcf.txt' (1 KB)

From: Jan Maarten van der Valk
Subject: Re: lining up an object with a vector
Date: 3 Oct 2002 05:11:31
Message: <3d9c09c3$1@news.povray.org>
"Jan Maarten van der Valk" <jm.### [at] hccnetnl> schreef in bericht
news:3d9c03c6@news.povray.org...
>
> How can I rotate an object so that it's up-coordination <0,1,0> lines up with
a
> given vector?
>

Found the answer myself after reading the 'Constrained motion' thread in p.a-u.
The Axis_rotate_Trans macro does the trick.

    Axis_Rotate_Trans(VPerp_To_Plane(y,Norm), VAngleD(y,Norm))

where Norm is the vector the object should be aligned with.

Cheers,
JM
--
#macro J(M)V()<V(),V(),V()>#if(M)J(M)#end#end#local _=20;#macro V()asc(substr
("IIMYKIIYMMKQOIMYQEEYSCEYUEGQWEHYYIGQ[HEY]IGY_JGQaJEYcKGYeKGQgLEYiMKIs#K ",
73-M,1))/2-36.5#declare M=M-1;#end#local a=spline{cubic_spline J(72)}#while
(_)sphere{a(_).1pigment{rgb(a(_)+(x+y)*3.5)}}#local _=_-.02;#end//JM


Post a reply to this message

From: Christopher James Huff
Subject: Re: lining up an object with a vector
Date: 3 Oct 2002 10:09:15
Message: <chrishuff-20E450.10061103102002@netplex.aussie.org>
In article <3d9c09c3$1@news.povray.org>,
 "Jan Maarten van der Valk" <jm.### [at] hccnetnl> wrote:

> Found the answer myself after reading the 'Constrained motion' thread in 
> p.a-u.
> The Axis_rotate_Trans macro does the trick.
> 
>     Axis_Rotate_Trans(VPerp_To_Plane(y,Norm), VAngleD(y,Norm))
> 
> where Norm is the vector the object should be aligned with.

That is a very odd way to do it, since if you know about 
Axis_Rotate_Trans() you should know about the other macros in that 
file..."Point_At_Trans(Norm)" should do the job fine.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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