computeNormal static method

void computeNormal(
  1. Vector3 va,
  2. Vector3 vb,
  3. Vector3 vc,
  4. Vector3 target,
)

Get face normal given 3 vertices

Implementation

static void computeNormal(Vector3 va, Vector3 vb, Vector3 vc, Vector3 target) {
  final cb = Vector3.zero();
  final ab = Vector3.zero();

  vb.sub2(va, ab);
  vc.sub2(vb, cb);
  cb.cross2(ab, target);
  if (!target.isZero()) {
    target.normalize();
  }
}