If I have a triangle with $3$ points $P_1, P_2,$ and $P_3$, each with $x, y,$ and $z$ coordinates, how do I find the surface normal $N$ in $x, y,$ and $z$ such that
$$(N_x)^2+(N_y)^2+(N_z)^2 = 1$$
I'm looking for a simple formula that uses values like $x_1$, $x_2$, or $y_3$, and doesn't involve complicated equations or cross products.
Best Answer
The cross product of two sides of the triangle equals the surface normal. So, if vector $V$ = $P_2$ - $P_1$, vector $W$ = $P_3$ - $P_1$, and vector $N$ is the surface normal, then:
$N_x = (V_y * W_z) - (V_z * W_y)$
$N_y = (V_z * W_x) - (V_x * W_z)$
$N_z = (V_x * W_y) - (V_y * W_x)$
If $A$ is the new vector whose components add up to 1, then:
$A_x = \frac {N_x}{(N_x)^2 + (N_y)^2 + (N_z)^2}$
$A_y = \frac {N_y}{(N_x)^2 + (N_y)^2 + (N_z)^2}$
$A_z = \frac {N_z}{(N_x)^2 + (N_y)^2 + (N_z)^2}$
My sources: http://en.wikipedia.org/wiki/Normal_(geometry)