getNormal static method

Vector3 getNormal(
  1. Vector3 a,
  2. Vector3 b,
  3. Vector3 c,
  4. Vector3 target,
)

Implementation

static Vector3 getNormal(Vector3 a, Vector3 b, Vector3 c, Vector3 target) {
  target.sub2(c, b);
  _v0.sub2(a, b);
  target.cross(_v0);

  final targetLengthSq = target.length2;
  if (targetLengthSq > 0) {
    // print(" targer: ${target.toJson()} getNormal scale: ${1 / math.sqrt( targetLengthSq )} ");
    target.scale(1 / math.sqrt(targetLengthSq));
    return target;
  }
  target.setValues(0, 0, 0);
  return target;
}