POV-Ray : Newsgroups : povray.general : A little vector problem : Re: A little vector problem Server Time
20 Nov 2024 12:38:54 EST (-0500)
  Re: A little vector problem  
From: Ron Parker
Date: 30 Aug 2001 15:00:30
Message: <slrn9ot3ag.3p7.ron.parker@fwi.com>
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

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