[ODE] Vector that's perpendicular to two others

Martin C. Martin martin at metahuman.org
Thu Apr 4 11:19:01 2002


Hi,

I'm working on the universal joint, I've got the constraint figured out,
I'll be testing it soon.  But there's a point where a need a vector
that's perpendicular to two other unit vectors.  At the moment, I take
the cross product then normalize it:

  dCROSS(p, =, ax1, ax2);
  dNormalize3(p);

Which should work fine unless ax1 and ax2 are almost the same.  For
example, if they're both (1, 0, 0), the p will end up being (1, 0, 0) as
well.  In this case, any vector perpendicular to the two of them will
do.

Is there any function or combination of functions which does a better
job?

Thanks,
Martin