intersection method
Find the intersection point between the three planes a
, b
and c
and
copy it into result
.
Implementation
static void intersection(Plane a, Plane b, Plane c, Vector3 result) {
final Vector3 cross = new Vector3.zero();
b.normal.crossInto(c.normal, cross);
final double f = -a.normal.dot(cross);
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);
result
..x = (v1.x + v2.x + v3.x) / f
..y = (v1.y + v2.y + v3.y) / f
..z = (v1.z + v2.z + v3.z) / f;
}