public float GetPlaneDistance(ref PlaneF plane) { Vector3F center; GetCenter(out center); float d1 = plane.GetDistance(ref center); float d2 = Math.Abs((Maximum.X - center.X) * plane.Normal.X) + Math.Abs((Maximum.Y - center.Y) * plane.Normal.Y) + Math.Abs((Maximum.Z - center.Z) * plane.Normal.Z); if (d1 - d2 > 0.0f) { return(d1 - d2); } if (d1 + d2 < 0.0f) { return(d1 + d2); } return(0.0f); }
public PlaneF.Side GetPlaneSide(ref PlaneF plane) { Vector3F center; GetCenter(out center); float d1 = plane.GetDistance(ref center); float d2 = Math.Abs((Maximum.X - center.X) * plane.A) + Math.Abs((Maximum.Y - center.Y) * plane.B) + Math.Abs((Maximum.Z - center.Z) * plane.C); if (d1 - d2 > 0) { return(PlaneF.Side.Positive); } if (d1 + d2 < 0) { return(PlaneF.Side.Negative); } return(PlaneF.Side.No); }