computeFaceNormals method

dynamic computeFaceNormals()

Implementation

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

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

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

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

    cb.normalize();

    face.normal.copy(cb);
  }
}