intersection method

void intersection (Plane a, Plane b, Plane c, Vector3 result)

Find the intersection point between the three planes a, b and c and copy it into result.


static void intersection(Plane a, Plane b, Plane c, Vector3 result) {
  final Vector3 cross = new;

  b.normal.crossInto(c.normal, cross);

  final double f =;

  final Vector3 v1 = cross.scaled(a.constant);

  c.normal.crossInto(a.normal, cross);

  final Vector3 v2 = cross.scaled(b.constant);

  a.normal.crossInto(b.normal, cross);

  final Vector3 v3 = cross.scaled(c.constant);

    ..x = (v1.x + v2.x + v3.x) / f
    ..y = (v1.y + v2.y + v3.y) / f
    ..z = (v1.z + v2.z + v3.z) / f;