public static void Intersects(ref BoundingSphere2 boundingSphere, ref BoundingBox2 boundingBox, out bool result) { Vector2 clampedLocation; if (boundingSphere.Center.X > boundingBox.Max.X) { clampedLocation.X = boundingBox.Max.X; } else if (boundingSphere.Center.X < boundingBox.Min.X) { clampedLocation.X = boundingBox.Min.X; } else { clampedLocation.X = boundingSphere.Center.X; } if (boundingSphere.Center.Y > boundingBox.Max.Y) { clampedLocation.Y = boundingBox.Max.Y; } else if (boundingSphere.Center.Y < boundingBox.Min.Y) { clampedLocation.Y = boundingBox.Min.Y; } else { clampedLocation.Y = boundingSphere.Center.Y; } result = clampedLocation.DistanceSquared(boundingSphere.Center) <= (boundingSphere.Radius * boundingSphere.Radius); }
public bool Intersects(BoundingBox2 boundingBox) { Vector2 clampedLocation; if (Center.X > boundingBox.Max.X) { clampedLocation.X = boundingBox.Max.X; } else if (Center.X < boundingBox.Min.X) { clampedLocation.X = boundingBox.Min.X; } else { clampedLocation.X = Center.X; } if (Center.Y > boundingBox.Max.Y) { clampedLocation.Y = boundingBox.Max.Y; } else if (Center.Y < boundingBox.Min.Y) { clampedLocation.Y = boundingBox.Min.Y; } else { clampedLocation.Y = Center.Y; } return clampedLocation.DistanceSquared(Center) <= (Radius * Radius); }
public bool Intersects(BoundingBox2 boundingBox) { Vector2 clampedLocation; if (Center.X > boundingBox.Max.X) { clampedLocation.X = boundingBox.Max.X; } else if (Center.X < boundingBox.Min.X) { clampedLocation.X = boundingBox.Min.X; } else { clampedLocation.X = Center.X; } if (Center.Y > boundingBox.Max.Y) { clampedLocation.Y = boundingBox.Max.Y; } else if (Center.Y < boundingBox.Min.Y) { clampedLocation.Y = boundingBox.Min.Y; } else { clampedLocation.Y = Center.Y; } return(clampedLocation.DistanceSquared(Center) <= (Radius * Radius)); }
public BoundingBox2 Merge(BoundingBox2 boundingBox2) { BoundingBox2 result; if (Min.X < boundingBox2.Min.X) { result.Min.X = Min.X; } else { result.Min.X = boundingBox2.Min.X; } if (Min.Y < boundingBox2.Min.Y) { result.Min.Y = Min.Y; } else { result.Min.Y = boundingBox2.Min.Y; } if (Max.X > boundingBox2.Max.X) { result.Max.X = Max.X; } else { result.Max.X = boundingBox2.Max.X; } if (Max.Y > boundingBox2.Max.Y) { result.Max.Y = Max.Y; } else { result.Max.Y = boundingBox2.Max.Y; } return(result); }
public static void Merge(ref BoundingBox2 boundingBox1, ref BoundingBox2 boundingBox2, out BoundingBox2 result) { if (boundingBox1.Min.X < boundingBox2.Min.X) { result.Min.X = boundingBox1.Min.X; } else { result.Min.X = boundingBox2.Min.X; } if (boundingBox1.Min.Y < boundingBox2.Min.Y) { result.Min.Y = boundingBox1.Min.Y; } else { result.Min.Y = boundingBox2.Min.Y; } if (boundingBox1.Max.X > boundingBox2.Max.X) { result.Max.X = boundingBox1.Max.X; } else { result.Max.X = boundingBox2.Max.X; } if (boundingBox1.Max.Y > boundingBox2.Max.Y) { result.Max.Y = boundingBox1.Max.Y; } else { result.Max.Y = boundingBox2.Max.Y; } }
public static void Intersects(ref BoundingBox2 boundingBox1, ref BoundingBox2 boundingBox2, out bool result) { result = !(boundingBox1.Min.X > boundingBox2.Max.X || boundingBox1.Min.Y > boundingBox2.Max.Y || boundingBox2.Min.X > boundingBox1.Max.X || boundingBox2.Min.Y > boundingBox1.Max.Y); }
public BoundingBox2 Merge(BoundingBox2 boundingBox2) { BoundingBox2 result; if (Min.X < boundingBox2.Min.X) result.Min.X = Min.X; else result.Min.X = boundingBox2.Min.X; if (Min.Y < boundingBox2.Min.Y) result.Min.Y = Min.Y; else result.Min.Y = boundingBox2.Min.Y; if (Max.X > boundingBox2.Max.X) result.Max.X = Max.X; else result.Max.X = boundingBox2.Max.X; if (Max.Y > boundingBox2.Max.Y) result.Max.Y = Max.Y; else result.Max.Y = boundingBox2.Max.Y; return result; }
public bool Intersects(BoundingBox2 boundingBox) { return !(boundingBox.Min.X > Max.X || boundingBox.Min.Y > Max.Y || Min.X > boundingBox.Max.X || Min.Y > boundingBox.Max.Y); }
public static void Merge(ref BoundingBox2 boundingBox1, ref BoundingBox2 boundingBox2, out BoundingBox2 result) { if (boundingBox1.Min.X < boundingBox2.Min.X) result.Min.X = boundingBox1.Min.X; else result.Min.X = boundingBox2.Min.X; if (boundingBox1.Min.Y < boundingBox2.Min.Y) result.Min.Y = boundingBox1.Min.Y; else result.Min.Y = boundingBox2.Min.Y; if (boundingBox1.Max.X > boundingBox2.Max.X) result.Max.X = boundingBox1.Max.X; else result.Max.X = boundingBox2.Max.X; if (boundingBox1.Max.Y > boundingBox2.Max.Y) result.Max.Y = boundingBox1.Max.Y; else result.Max.Y = boundingBox2.Max.Y; }
public void Intersects(BoundingBox2 boundingBox, out bool result) { result = X >= boundingBox.Left && X <= boundingBox.Right && Y >= boundingBox.Bottom && Y <= boundingBox.Top; }
public bool Intersects(BoundingBox2 boundingBox) { return(X >= boundingBox.Left && X <= boundingBox.Right && Y >= boundingBox.Bottom && Y <= boundingBox.Top); }
public bool Intersects(BoundingBox2 boundingBox) { return (!(boundingBox.Min.X > Max.X || boundingBox.Min.Y > Max.Y || Min.X > boundingBox.Max.X || Min.Y > boundingBox.Max.Y)); }