computeNormal static method

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

Get face normal given 3 vertices

Implementation

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

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