Search code examples
computational-geometrynumerical-methods

Compute perpendicular vector to a known vector, both embedded in the same plane, in 3D (R^3)


it seems to me that this is kind of a very easy question, but today I don't seem to find a reasonable answer by myself. I have two points, A and B in R^3 (3D) that belong to plane PI. I want to find a vector r in PI, perpendicular to the vector v = A - B. I know vector n, the normal of plane PI. Mathematically I can solve v.r = 0 and v x r = n, but the solution of this system in terms of r involves some divisions that I suspect could bring some numerical instabilities. Can you suggest me any numerical/computationally good solution for this problem?

Thanks in advance,

Federico


Solution

  • Why not just compute the cross product V x N ?

    Since the solution is in Pi, it is perpendicular to N, and V, so... ?