Posted 22 August 2011 - 08:26 AM
vertice plane_a(700.0f, 500.0f,0.0f);
vertice plane_b(720.0f, 500.0f,0.0f);
vertice plane_c(720.0f, 300.0f,0.0f);
vertice plane_d(700.0f, 300.0f,0.0f);
vector b(b,c);//these constructors are defined as head - tail so the vector here is going to be c.x - b.x, c.y - b.y, c.z - b.z
vector crossvec = crossprod(a,b);
// Cx = AyBz - AzBy
//Cy = AzBx - AxBz
//Cz = AxBy - AyBx
//now you want to normalize the crossproduct you do that via sqrt(x^2 + y^2 + z^2) and then divide each of its coordinates by the value obtained. Last but not least you add the resultant vector (which is going to be 0,0,1 or ideally close to it) to one of the planes four vertices. Yeah, the normal here is one along the z but the method I described works for any plane orientation.
For a plane normal you need a third dimension. Then you take two edges of the plane that share the same corners, make vectors of them, take the cross product of those vectors and then normalize the cross product. So let's give your plane a z axis... and put them in a vertex (pseudo) class so the data can be manipulated by us...
"It's like naming him Asskicker Monstertrucktits O'Ninja" -Khaiy