|
|
On Thu, 30 Aug 2001 20:31:11 +0200, Micha Riser wrote:
>What is the easiest (fastest) way to check in pov whether the angle between
>two normalized vectors is >90 degrees? I am currently testing if
>vlength(A-B)>sqrt(2)
>
>And what is the easiest way to check if two colinear vectors point in the
>same direction?
The answer to both questions is vdot. For the first question, the angle is
obtuse if the dot product is negative. For the second, they point in the same
direction if the dot product is positive.
--
#local R=rgb 99;#local P=R-R;#local F=pigment{gradient x}box{0,1pigment{gradient
y pigment_map{[.5F pigment_map{[.3R][.3F color_map{[.15red 99][.15P]}rotate z*45
translate x]}]#local H=pigment{gradient y color_map{[.5P][.5R]}scale 1/3}[.5F
pigment_map{[.3R][.3H][.7H][.7R]}]}}}camera{location.5-3*z}//only my opinions
Post a reply to this message
|
|
|
|
1) vdot()
given normalized vectors A and B, vdot(A,B) is 1 if they are parallel/equal,
0 if perpendicular, -1 if pointing in opposite directions, and in general,
cos(angle between). So the condition you are looking for is vdot(A,B)<0.
Given general normalized or un-normalized vectors,vdot(A,B)>0 means angle
less than 90, vdot(A,B)=0 are perpendicular, and vdot(A,B)<0 means angle
more than 90.
2) vdot(vnormal(A),vnormal(B))=1 for any two parallel vectors
Chris
"Micha Riser" <mri### [at] gmxnet> wrote in message
news:3b8e877a$1@news.povray.org...
> What is the easiest (fastest) way to check in pov whether the angle
between
> two normalized vectors is >90 degrees? I am currently testing if
> vlength(A-B)>sqrt(2)
>
> And what is the easiest way to check if two colinear vectors point in the
> same direction?
>
> - Micha
Post a reply to this message
|
|