Microsoft.Xna.Framework
Class BoundingSphere

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

public final class BoundingSphere
extends ValueType
implements IEquatable<BoundingSphere>

Defines a sphere.

Author:
Halofreak1990

Field Summary
 Vector3 Center
          The center point of the sphere.
 float Radius
          The radius of the sphere.
 
Constructor Summary
BoundingSphere()
          Creates a new instance of BoundingSphere.
BoundingSphere(Vector3 center, float radius)
          Creates a new instance of BoundingSphere.
 
Method Summary
 ContainmentType Contains(BoundingBox box)
          Checks whether the current BoundingSphere contains the specified BoundingBox.
 void Contains(BoundingBox box, ContainmentType result)
          Checks whether the current BoundingSphere contains the specified BoundingBox.
 ContainmentType Contains(BoundingSphere sphere)
          Checks whether the current BoundingSphere contains the specified BoundingSphere.
 void Contains(BoundingSphere sphere, ContainmentType result)
          Checks whether the current BoundingSphere contains the specified BoundingSphere.
 ContainmentType Contains(Vector3 point)
          Checks whether the current BoundingSphere contains the specified point.
 void Contains(Vector3 point, ContainmentType result)
          Checks whether the current BoundingSphere contains the specified point.
static BoundingSphere CreateFromBoundingBox(BoundingBox box)
          Creates the smallest BoundingSphere that can contain a specified BoundingBox.
static void CreateFromBoundingBox(BoundingBox box, BoundingSphere result)
          Creates the smallest BoundingSphere that can contain a specified BoundingBox.
static BoundingSphere CreateMerged(BoundingSphere original, BoundingSphere additional)
          Creates a BoundingSphere that contains the two specified BoundingSphere instances.
static void CreateMerged(BoundingSphere original, BoundingSphere additional, BoundingSphere result)
          Creates a BoundingSphere that contains the two specified BoundingSphere instances.
 boolean Equals(BoundingSphere other)
          Determines whether the specified BoundingSphere is equal to the current BoundingSphere.
 boolean equals(java.lang.Object obj)
          Determines whether the specified Object is equal to the BoundingSphere.
 int hashCode()
          Gets the hash code for this instance.
 boolean Intersects(BoundingBox box)
          Checks whether the current BoundingSphere intersects with a specified BoundingBox.
 void Intersects(BoundingBox box, boolean result)
          Checks whether the current BoundingSphere intersects a BoundingBox.
 boolean Intersects(BoundingSphere sphere)
          Checks whether the current BoundingSphere intersects with a specified BoundingSphere.
 void Intersects(BoundingSphere sphere, boolean result)
          Checks whether the current BoundingSphere intersects another BoundingSphere.
 PlaneIntersectionType Intersects(Plane plane)
          Checks whether the current BoundingSphere intersects with a specified Plane.
 void Intersects(Plane plane, PlaneIntersectionType result)
          Checks whether the current BoundingSphere intersects a Plane.
 java.lang.Float Intersects(Ray ray)
          Checks whether the current BoundingSphere intersects with a specified Ray.
 void Intersects(Ray ray, java.lang.Float result)
          Checks whether the current BoundingSphere intersects a Ray.
 java.lang.String toString()
          Returns a String that represents the current BoundingSphere.
 BoundingSphere Transform(Matrix matrix)
          Translates and scales the BoundingSphere using a given Matrix.
 void Transform(Matrix matrix, BoundingSphere result)
          Translates and scales the BoundingSphere using a given Matrix.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

Center

public Vector3 Center
The center point of the sphere.


Radius

public float Radius
The radius of the sphere.

Constructor Detail

BoundingSphere

public BoundingSphere(Vector3 center,
                      float radius)
Creates a new instance of BoundingSphere.

Parameters:
center - Center point of the sphere.
radius - Radius of the sphere.

BoundingSphere

public BoundingSphere()
Creates a new instance of BoundingSphere.

Method Detail

Contains

public ContainmentType Contains(BoundingBox box)
Checks whether the current BoundingSphere contains the specified BoundingBox.

Parameters:
box - The BoundingBox to check against the current BoundingSphere.
Returns:
An enumeration indicating the relationship of the specified BoundingBox to the current BoundingSphere.

Contains

public ContainmentType Contains(BoundingSphere sphere)
Checks whether the current BoundingSphere contains the specified BoundingSphere.

Parameters:
sphere - The BoundingSphere to check against the current BoundingSphere.
Returns:
An enumeration indicating the relationship of the BoundingSpheres.

Contains

public ContainmentType Contains(Vector3 point)
Checks whether the current BoundingSphere contains the specified point.

Parameters:
point - The point to check against the current BoundingSphere.
Returns:
An enumeration indicating the relationship of the specified point to the current BoundingSphere.

Contains

public void Contains(BoundingBox box,
                     ContainmentType result)
Checks whether the current BoundingSphere contains the specified BoundingBox.

Parameters:
box - The BoundingBox to test for overlap.
result - [OutAttribute] Enumeration indicating the extent of overlap.

Contains

public void Contains(BoundingSphere sphere,
                     ContainmentType result)
Checks whether the current BoundingSphere contains the specified BoundingSphere.

Parameters:
sphere - The BoundingSphere to test for overlap.
result - [OutAttribute] Enumeration indicating the extent of overlap.

Contains

public void Contains(Vector3 point,
                     ContainmentType result)
Checks whether the current BoundingSphere contains the specified point.

Parameters:
point - The point to test for overlap.
result - [OutAttribute] Enumeration indicating the extent of overlap.

CreateFromBoundingBox

public static BoundingSphere CreateFromBoundingBox(BoundingBox box)
Creates the smallest BoundingSphere that can contain a specified BoundingBox.

Parameters:
box - The BoundingBox to create the BoundingSphere from.
Returns:
The created BoundingSphere.

CreateFromBoundingBox

public static void CreateFromBoundingBox(BoundingBox box,
                                         BoundingSphere result)
Creates the smallest BoundingSphere that can contain a specified BoundingBox.

Parameters:
box - The BoundingBox to create the BoundingSphere from.
result - [OutAttribute] The created BoundingSphere.

CreateMerged

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

Parameters:
original - BoundingSphere to be merged.
additional - BoundingSphere to be merged.
Returns:
The created BoundingSphere.

CreateMerged

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

Parameters:
original - BoundingSphere to be merged.
additional - BoundingSphere to be merged.
result - [OutAttribute] The created BoundingSphere.

equals

public boolean equals(java.lang.Object obj)
Determines whether the specified Object is equal to the BoundingSphere.

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

Equals

public boolean Equals(BoundingSphere other)
Determines whether the specified BoundingSphere is equal to the current BoundingSphere.

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

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 BoundingSphere.

Intersects

public boolean Intersects(BoundingBox box)
Checks whether the current BoundingSphere intersects with a specified BoundingBox.

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

Intersects

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

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

Intersects

public PlaneIntersectionType Intersects(Plane plane)
Checks whether the current BoundingSphere intersects with a specified Plane.

Parameters:
plane - The Plane to check for intersection with the current BoundingSphere.
Returns:
An enumeration indicating the relationship between the BoundingSphere and the Plane.

Intersects

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

Parameters:
ray - The Ray to check for intersection with the current BoundingSphere.

Intersects

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

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

Intersects

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

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

Intersects

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

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

Intersects

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

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

toString

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

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

Transform

public BoundingSphere Transform(Matrix matrix)
Translates and scales the BoundingSphere using a given Matrix.

Parameters:
matrix - A transformation matrix that might include translation, rotation, or uniform scaling. Note that BoundingSphere.Transform will not return correct results if there are non-uniform scaling, shears, or other unusual transforms in this transformation matrix. This is because there is no way to shear or non-uniformly scale a sphere. Such an operation would cause the sphere to lose its shape as a sphere.

Transform

public void Transform(Matrix matrix,
                      BoundingSphere result)
Translates and scales the BoundingSphere using a given Matrix.

Parameters:
matrix - A transformation matrix that might include translation, rotation, or uniform scaling. Note that BoundingSphere.Transform will not return correct results if there are non-uniform scaling, shears, or other unusual transforms in this transformation matrix. This is because there is no way to shear or non-uniformly scale a sphere. Such an operation would cause the sphere to lose its shape as a sphere.
result - [OutAttribute] The transformed BoundingSphere.