POV-Ray : Newsgroups : povray.general : Perpendicular to an arbitrary axis : Re: Perpendicular to an arbitrary axis Server Time
2 Aug 2024 20:21:02 EDT (-0400)
  Re: Perpendicular to an arbitrary axis  
From: Tor Olav Kristensen
Date: 2 Aug 2004 20:33:52
Message: <410edd70$1@news.povray.org>
Slime wrote:
...
> To get a vector perpendicular to another vector, you just do a vcross with
> any other vector:
> 
> #local x_point = vcross(x, l_point_at); // get a perpendicular
> 
> But this can always pose a problem, since you have to ensure that the vector
> you choose (x in this case, l_source in your case) isn't parallel to the
> vector you're finding a perpendicular for (l_point_at).
> 
> The simplest solution is this:
> 
> #local x_point = vcross(x, l_point_at);
> #if (vlength(x_point) = 0)
>     #local x_point = vcross(y, l_point_at); // if x was parallel to
> l_point_at, try y instead
> #end
> 
> In any case, there is a function in math.inc, VPerp_To_Vector(V), which will
> find a vector perpendicular to l_point_at if you do
> VPerp_To_Vector(l_point_at). I wouldn't be surprised if it uses the same
> method I just mentioned.

It's a little bit different.

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


Post a reply to this message

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