/** * Computes the area-weighted average normal vector for this node. * @param vn array to contain the {X,Y,Z} components of the normal vector. */ public void normalVector(float[] vn) { vn[0] = vn[1] = vn[2] = 0.0f; FaceIterator fi = getFaces(); while (fi.hasNext()) { Face face = fi.next(); accNormalVector(face,vn); } float x = vn[0]; float y = vn[1]; float z = vn[2]; float s = 1.0f/(float)sqrt(x*x+y*y+z*z); vn[0] *= s; vn[1] *= s; vn[2] *= s; }