// calculate the point of intersection of this plane and 2 others // based on "Intersection of 3 Planes" http://geomalgorithms.com/a05-_intersect-1.html public bool GetIntersection(Plane a, Plane b, ref Vec3 intersection) { float denom = Vec3.Dot(this.Normal, Vec3.Cross(a.Normal, b.Normal)); if (Math.Abs(denom) < Constants.Epsilon) { return(false); } intersection = (((Vec3.Cross(a.Normal, b.Normal) * -this.Distance) - (Vec3.Cross(b.Normal, this.Normal) * a.Distance) - (Vec3.Cross(this.Normal, a.Normal) * b.Distance)) / denom); return(true); }
public static Vec3 Cross(Vec3 a, Vec3 b) { return(a.Cross(b)); }