private void normalize ( final Element vertex ) { double nx = vertex . getDouble ( "nx" ) ; double ny = vertex . getDouble ( "ny" ) ; double nz = vertex . getDouble ( "nz" ) ; double n = Math . sqrt ( nx * nx + ny * ny + nz * nz ) ; if ( n < EPSILON ) { vertex . setDouble ( "nx" , 0 ) ; vertex . setDouble ( "ny" , 0 ) ; vertex . setDouble ( "nz" , 0 ) ; } vertex . setDouble ( "nx" , nx / n ) ; vertex . setDouble ( "ny" , ny / n ) ; vertex . setDouble ( "nz" , nz / n ) ; }
Normalizes the normal vector of a vertex .