2
$\begingroup$

I'm writing a computer graphics library, and I'd like to compute the plane that passes through three arbitrary points, $p$, $q$ and $r$. I'm defining the plane in the form of $Ax + By + Cz + D = 0$.

My algebra is rather rusty, but I suspect this is a job for some simultaneous equations I'll need to solve a system of equations:

$$0 = \begin{cases} Ax_p + By_p + Cz_p + D \\ Ax_q + By_q + Cz_q+ D \\ Ax_r + By_r + Cz_r + D \end{cases}$$

How would I efficiently find the values of $A$, $B$, $C$ and $D$ with respect to $p$, $q$ and $r$?

  • 4
    The problem is called "solving a system of linear equations" and it is easy to find libraries which do this for you. Alternatively, you can implement [this algorithm](http://en.wikipedia.org/wiki/Gaussian_elimination) yourself.2012-12-23
  • 0
    Cheers. I updated the question and am looking at you link. I'm using an obscure new language, hence me having to write the library myself.2012-12-23
  • 0
    It is not hard to implement it yourself. Use [Gauss' algorithm](http://en.wikipedia.org/wiki/Gaussian_elimination#Pseudocode) to bring it to row echelon form and then use [back-substitution](http://en.wikipedia.org/wiki/Triangular_matrix#Forward_and_back_substitution).2012-12-23

1 Answers 1