float normal[] = new float[coord.length];
Vector3d v1 = new Vector3d();
Vector3d v2 = new Vector3d();
Vector3d faceNormal = new Vector3d();
Point3d a = new Point3d();
Point3d b = new Point3d();
Point3d c = new Point3d();
// step through all the faces
for (int i=0; i<idx.length; i+=3) {
int ja = idx[i] * 3;
a.set(coord[ja],coord[ja+1],coord[ja+2]);
int jb = idx[i+1] * 3;
b.set(coord[jb],coord[jb+1],coord[jb+2]);
int jc = idx[i+2] * 3;
c.set(coord[jc],coord[jc+1],coord[jc+2]);
v1.sub(b, a);
v2.sub(c, a);
faceNormal.cross(v1, v2);
if (faceNormal.length()==0) continue;