computeFaceNormals method

dynamic computeFaceNormals()

Implementation

computeFaceNormals() {
  var cb = three.Vector3.init(), ab = three.Vector3.init();

  for (var f = 0, fl = faces.length; f < fl; f++) {
    var face = faces[f];

    var vA = vertices[face.a];
    var vB = vertices[face.b];
    var vC = vertices[face.c];

    cb.subVectors(vC, vB);
    ab.subVectors(vA, vB);
    cb.cross(ab);

    cb.normalize();

    face.normal.copy(cb);
  }
}