Microsoft.Xna.Framework
Class BoundingBox

java.lang.Object
  extended by System.ValueType
      extended by Microsoft.Xna.Framework.BoundingBox
All Implemented Interfaces:
IEquatable<BoundingBox>

public final class BoundingBox
extends ValueType
implements IEquatable<BoundingBox>

Defines an axis-aligned box-shaped 3D volume.

Author:
Halofreak1990

Field Summary
 int CornerCount
          Specifies the total number of corners (8) in the BoundingBox.
 Vector3 Max
          The maximum point the BoundingBox contains.
 Vector3 Min
          The minimum point the BoundingBox contains.
 
Constructor Summary
BoundingBox()
          Creates an instance of BoundingBox.
BoundingBox(Vector3 min, Vector3 max)
          Creates an instance of BoundingBox.
 
Method Summary
 ContainmentType Contains(BoundingBox box)
          Tests whether the BoundingBox contains another BoundingBox.
 ContainmentType Contains(BoundingSphere sphere)
          Tests whether the BoundingBox contains a BoundingSphere.
 ContainmentType Contains(Vector3 point)
          Tests whether the BoundingBox contains a point.
static BoundingBox CreateFromSphere(BoundingSphere sphere)
          Creates the smallest BoundingBox that will contain the specified BoundingSphere.
static void CreateFromSphere(BoundingSphere sphere, BoundingBox result)
          Creates the smallest BoundingBox that will contain the specified BoundingSphere.
static BoundingBox CreateMerged(BoundingBox original, BoundingBox additional)
          Creates the smallest BoundingBox that contains the two specified BoundingBox instances.
static void CreateMerged(BoundingBox original, BoundingBox additional, BoundingBox result)
          Creates the smallest BoundingBox that contains the two specified BoundingBox instances.
 boolean Equals(BoundingBox other)
          Determines whether two instances of BoundingBox are equal.
 boolean equals(java.lang.Object obj)
          Determines whether two instances of BoundingBox are equal.
 Vector3[] GetCorners()
          Gets an array of points that make up the corners of the BoundingBox.
 void GetCorners(Vector3[] corners)
          Defines an axis-aligned box-shaped 3D volume.
 int hashCode()
          Gets the hash code for this instance.
 boolean Intersects(BoundingBox box)
          Checks whether the current BoundingBox intersects another BoundingBox.
 void Intersects(BoundingBox box, boolean result)
          Checks whether the current BoundingBox intersects another BoundingBox.
 boolean Intersects(BoundingSphere sphere)
          Checks whether the current BoundingBox intersects a BoundingSphere.
 void Intersects(BoundingSphere sphere, boolean result)
          Checks whether the current BoundingBox intersects a BoundingSphere.
 PlaneIntersectionType Intersects(Plane plane)
          Checks whether the current BoundingBox intersects a Plane.
 void Intersects(Plane plane, PlaneIntersectionType result)
          Checks whether the current BoundingBox intersects a Plane.
 java.lang.Float Intersects(Ray ray)
          Checks whether the current BoundingBox intersects a Ray.
 void Intersects(Ray ray, java.lang.Float result)
          Checks whether the current BoundingBox intersects a Ray.
 java.lang.String toString()
          Returns a String that represents the current BoundingBox.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CornerCount

public final int CornerCount
Specifies the total number of corners (8) in the BoundingBox.

See Also:
Constant Field Values

Max

public Vector3 Max
The maximum point the BoundingBox contains.


Min

public Vector3 Min
The minimum point the BoundingBox contains.

Constructor Detail

BoundingBox

public BoundingBox(Vector3 min,
                   Vector3 max)
Creates an instance of BoundingBox.

Parameters:
min - The minimum point the BoundingBox includes.
max - The maximum point the BoundingBox includes.

BoundingBox

public BoundingBox()
Creates an instance of BoundingBox.

Method Detail

Contains

public ContainmentType Contains(BoundingBox box)
Tests whether the BoundingBox contains another BoundingBox.

Parameters:
box - The BoundingBox to test for overlap.

Contains

public ContainmentType Contains(BoundingSphere sphere)
Tests whether the BoundingBox contains a BoundingSphere.

Parameters:
sphere - The BoundingSphere to test for overlap.

Contains

public ContainmentType Contains(Vector3 point)
Tests whether the BoundingBox contains a point.

Parameters:
point - The point to test for overlap.

CreateFromSphere

public static BoundingBox CreateFromSphere(BoundingSphere sphere)
Creates the smallest BoundingBox that will contain the specified BoundingSphere.

Parameters:
sphere - The BoundingSphere to contain.

CreateFromSphere

public static void CreateFromSphere(BoundingSphere sphere,
                                    BoundingBox result)
Creates the smallest BoundingBox that will contain the specified BoundingSphere.

Parameters:
sphere - The BoundingSphere to contain.
result - [OutAttribute] The created BoundingBox.

CreateMerged

public static BoundingBox CreateMerged(BoundingBox original,
                                       BoundingBox additional)
Creates the smallest BoundingBox that contains the two specified BoundingBox instances.

Parameters:
original - One of the BoundingBoxs to contain.
additional - One of the BoundingBoxs to contain.

CreateMerged

public static void CreateMerged(BoundingBox original,
                                BoundingBox additional,
                                BoundingBox result)
Creates the smallest BoundingBox that contains the two specified BoundingBox instances.

Parameters:
original - One of the BoundingBoxs to contain.
additional - One of the BoundingBoxs to contain.
result - [OutAttribute] The created BoundingBox.

equals

public boolean equals(java.lang.Object obj)
Determines whether two instances of BoundingBox are equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The Object to compare with the current BoundingBox.
Returns:
true if the specified Object is equal to the current BoundingBox; false otherwise.

Equals

public boolean Equals(BoundingBox other)
Determines whether two instances of BoundingBox are equal.

Specified by:
Equals in interface IEquatable<BoundingBox>
Parameters:
other - The BoundingBox to compare with the current BoundingBox.
Returns:
true if the specified BoundingBox is equal to the current BoundingBox; false otherwise.

GetCorners

public Vector3[] GetCorners()
Gets an array of points that make up the corners of the BoundingBox.

Returns:
An array of Vector3 points that represent the corners of the BoundingBox.

GetCorners

public void GetCorners(Vector3[] corners)
Defines an axis-aligned box-shaped 3D volume.

Parameters:
corners - An existing array of at least 8 Vector3 points where the corners of the BoundingBox are written.
Throws:
ArgumentNullException
ArgumentOutOfRangeException

hashCode

public int hashCode()
Gets the hash code for this instance.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for the current BoundingBox.

Intersects

public boolean Intersects(BoundingBox box)
Checks whether the current BoundingBox intersects another BoundingBox.

Parameters:
box - The BoundingBox to check for intersection with.
Returns:
true if the BoundingBoxs intersect; false otherwise.

Intersects

public boolean Intersects(BoundingSphere sphere)
Checks whether the current BoundingBox intersects a BoundingSphere.

Parameters:
sphere - The BoundingSphere to check for intersection with.
Returns:
true if the BoundingBox and BoundingSphere intersect; false otherwise.

Intersects

public PlaneIntersectionType Intersects(Plane plane)
Checks whether the current BoundingBox intersects a Plane.

Parameters:
plane - The Plane to check for intersection with.
Returns:
An enumeration indicating whether the BoundingBox intersects the Plane.

Intersects

public java.lang.Float Intersects(Ray ray)
Checks whether the current BoundingBox intersects a Ray.

Parameters:
ray - The Ray to check for intersection with.
Returns:
Distance at which the ray intersects the BoundingBox, or null if there is no intersection.

Intersects

public void Intersects(BoundingBox box,
                       boolean result)
Checks whether the current BoundingBox intersects another BoundingBox.

Parameters:
box - The BoundingBox to check for intersection with.
result - [OutAttribute] true if the BoundingBox instances intersect; false otherwise.

Intersects

public void Intersects(BoundingSphere sphere,
                       boolean result)
Checks whether the current BoundingBox intersects a BoundingSphere.

Parameters:
sphere - The BoundingSphere to check for intersection with.
result - [OutAttribute] true if the BoundingBox and BoundingSphere intersect; false otherwise.

Intersects

public void Intersects(Plane plane,
                       PlaneIntersectionType result)
Checks whether the current BoundingBox intersects a Plane.

Parameters:
plane - The Plane to check for intersection with.
result - [OutAttribute] An enumeration indicating whether the BoundingBox intersects the Plane.

Intersects

public void Intersects(Ray ray,
                       java.lang.Float result)
Checks whether the current BoundingBox intersects a Ray.

Parameters:
ray - The Ray to check for intersection with.
result - [OutAttribute] Distance at which the ray intersects the BoundingBox, or null if there is no intersection.

toString

public java.lang.String toString()
Returns a String that represents the current BoundingBox.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the current BoundingBox.