Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

Thanks in advance!

share|cite|improve this question
up vote 1 down vote accepted

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?

share|cite|improve this answer
Great, that was what I was looking for! No, it doesnt have to go through C. As I said I will be using e as a rotation axis. The point to rotate around will be A then, but that is something the framework does for me :). Thanks again! – Philip Daubmeier Apr 3 '12 at 13:45
@PhilipDaubmeier: Glad to help. I now recall there is an identity that may help, found at 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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.