# Calculating the orthogonal vector of a line inside a plane

Writing a computer graphics related program, I cant figure out how to solve the following problem:

In a 3D space, I have given:

• 3 distinct points, that describe a plane.
• 2 of those points describe a line (inside the plane).

I am now looking for:

• The vector that is orthogonal to the line, and also lies inside the plane.

As I use the resulting vector as the rotation axis of a quaternion rotation, the direction (positive/negative) or length doesnt matter. How can I calculate this vector?

You can use the cross product. If your points are $A, B$, and $C$ and you want a vector in the plane of these three perpendicular to $AB$, you can use $d = AB \times AC$ to be a vector perpendicular to both. Then $e=AB \times d$ will be in the plane (as it is perpendicular to $d$) and perpendicular to $AB$. Did you want to require that $e$ go through $C$ as well?
@PhilipDaubmeier: Glad to help. I now recall there is an identity that may help, found at en.wikipedia.org/wiki/Triple_product that $a\times (a \times b)=a (b \cdot a) - b (a \cdot a)$ which may make it cleaner – Ross Millikan Apr 3 '12 at 14:18