0
$\begingroup$

Hi I have the following co-ordinates, which make up my triangle based pyramid. I need to calculate the normals of each face. However Im struggling to find the best simplest way to do this?

-0.5, 0, 0.5,  0, 0, -0.5, 0.5, 0, 0.5,  0, 0, -0.5, 0.5, 0, 0.5, 0, 1, 0,  -0.5, 0, 0.5, 0, 0, -0.5, 0, 1, 0,  0.5, 0, 0.5, -0.5, 0, 0.5, 0, 1, 0 

enter image description here

  • 0
    What is the norm of a face? Do you mean its area?2012-08-13
  • 0
    No I meant the normal. Ive added a picture to clarify. I believe the technical term is: a line from the origin, which is perpendicular to the face it passes through.2012-08-13
  • 0
    @geminiCoder If you're making models that you intend to use in a Direct3D engine, using Maya / 3DS Max and then exporting the model to .obj file format can save you time. It automatically calculates the norms (lines that begin with `vn`. The norm of a plane $ax+by+cz+d=0$ is $(a,b,c)$. You may normalize it. Also, the cross product of two non-parallel vectors in the plane is perpendicular to the plane, like @enzotib 's answer.2012-08-13
  • 0
    Look up Newell's algorithm.2012-08-13

1 Answers 1

1

Given three non aligned point of a face, say $A, B, C$, build the vectors $$ \mathbf{u}=B-A,\\ \mathbf{v}=C-A. $$ The vector $\mathbf{n}=\mathbf{u}\times\mathbf{v}$ is normal to the given face, you should only normalize its length.


Take $$ A=(-1/2, 0, 1/2),\\ B=(0, 0, -1/2),\\ C=(1/2, 0, 1/2), $$ then build $$ \mathbf{u}=B-A=( 0, 0, -1/2)-(-1/2, 0, 1/2)=(1/2,0,-1),\\ \mathbf{v}=C-A=(1/2, 0, 1/2)-(-1/2, 0, 1/2)=(1,0,0). $$ and $$ \mathbf{n}=\mathbf{u}\times\mathbf{v}=\left| \begin{matrix} i &j &k\\ 1/2 &0 &-1\\ 1 &0 &0 \end{matrix} \right|=(0,-1,0) $$ The resulting vector is, in this particular case, already normalized.

  • 0
    I know its a bit cheeky, but could you give me and example using the co-ordinates above. I would be most grateful!2012-08-13
  • 0
    Thanks thats fantastic. I appreciate your time2012-08-13
  • 1
    For consistency, one would want to ensure that the vertices of the polygons are all "clockwise" or "anticlockwise" before computing the normals, lest one obtain a result where some of the normals are pointing "outside" the pyramid, and the others are pointing "inside".2012-08-14