/// <summary> /// Checks whether the current BoundingBoxI intersects a BoundingSphere. /// </summary> /// <param name="sphere">The BoundingSphere to check for intersection with.</param> //public bool Intersects(BoundingSphere sphere) //{ // return Intersects(ref sphere); //} /// <summary> /// Checks whether the current BoundingBoxI intersects a BoundingSphere. /// </summary> /// <param name="sphere">The BoundingSphere to check for intersection with.</param><param name="result">[OutAttribute] true if the BoundingBoxI and BoundingSphere intersect; false otherwise.</param> //public void Intersects(ref BoundingSphere sphere, out bool result) //{ // Vector3I result1; // Vector3I.Clamp(ref sphere.Center, ref this.Min, ref this.Max, out result1); // float result2; // Vector3I.DistanceSquared(ref sphere.Center, ref result1, out result2); // result = (double)result2 <= (double)sphere.Radius * (double)sphere.Radius; //} //public bool Intersects(ref BoundingSphere sphere) //{ // Vector3I result1; // Vector3I.Clamp(ref sphere.Center, ref this.Min, ref this.Max, out result1); // float result2; // Vector3I.DistanceSquared(ref sphere.Center, ref result1, out result2); // return (double)result2 <= (double)sphere.Radius * (double)sphere.Radius; //} //public bool Intersects(ref BoundingSphereD sphere) //{ // Vector3I result1; // Vector3I center = (Vector3I)sphere.Center; // Vector3I.Clamp(ref center, ref this.Min, ref this.Max, out result1); // float result2; // Vector3I.DistanceSquared(ref center, ref result1, out result2); // return (double)result2 <= (double)sphere.Radius * (double)sphere.Radius; //} public float Distance(Vector3I point) { var clamp = Vector3I.Clamp(point, Min, Max); return((clamp - point).Length()); }
public float Distance(Vector3I point) { Vector3I vectori2 = Vector3I.Clamp(point, this.Min, this.Max) - point; return((float)vectori2.Length()); }