Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Contains() [5/7]

void Microsoft.Xna.Framework.BoundingBox.Contains ( ref BoundingSphere sphere,
out ContainmentType result )
inline

Definition at line 523 of file BoundingBox.cs.

524 {
525 Vector3.Clamp(ref sphere.Center, ref Min, ref Max, out var result2);
526 Vector3.DistanceSquared(ref sphere.Center, ref result2, out var result3);
527 float radius = sphere.Radius;
528 if (result3 > radius * radius)
529 {
530 result = ContainmentType.Disjoint;
531 }
532 else
533 {
534 result = ((Min.X + radius <= sphere.Center.X && sphere.Center.X <= Max.X - radius && Max.X - Min.X > radius && Min.Y + radius <= sphere.Center.Y && sphere.Center.Y <= Max.Y - radius && Max.Y - Min.Y > radius && Min.Z + radius <= sphere.Center.Z && sphere.Center.Z <= Max.Z - radius && Max.X - Min.X > radius) ? ContainmentType.Contains : ContainmentType.Intersects);
535 }
536 }

References Microsoft.Xna.Framework.Vector3.Clamp(), Microsoft.Xna.Framework.Vector3.DistanceSquared(), Microsoft.Xna.Framework.BoundingBox.Max, and Microsoft.Xna.Framework.BoundingBox.Min.