|
|
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
|
|