Class BoundingSphere
Defines a sphere.
Inheritance
Namespace: VRageMath
Assembly: VRage.Math.dll
Syntax
public sealed class BoundingSphere : ValueType, IEquatable<BoundingSphere>
Constructors
BoundingSphere(Vector3, Single)
Creates a new instance of BoundingSphere.
Declaration
public BoundingSphere(Vector3 center, float radius)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | center | Center point of the sphere. |
System.Single | radius | Radius of the sphere. |
Fields
Center
The center point of the sphere.
Declaration
public Vector3 Center
Field Value
Type | Description |
---|---|
Vector3 |
Radius
The radius of the sphere.
Declaration
public float Radius
Field Value
Type | Description |
---|---|
System.Single |
Methods
Contains(BoundingBox)
Checks whether the current BoundingSphere contains the specified BoundingBox.
Declaration
public ContainmentType Contains(BoundingBox box)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The BoundingBox to check against the current BoundingSphere. |
Returns
Type | Description |
---|---|
ContainmentType |
Contains(ref BoundingBox, out ContainmentType)
Checks whether the current BoundingSphere contains the specified BoundingBox.
Declaration
public void Contains(ref BoundingBox box, out ContainmentType result)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The BoundingBox to test for overlap. |
ContainmentType | result | [OutAttribute] Enumeration indicating the extent of overlap. |
Contains(BoundingFrustum)
Checks whether the current BoundingSphere contains the specified BoundingFrustum.
Declaration
public ContainmentType Contains(BoundingFrustum frustum)
Parameters
Type | Name | Description |
---|---|---|
BoundingFrustum | frustum | The BoundingFrustum to check against the current BoundingSphere. |
Returns
Type | Description |
---|---|
ContainmentType |
Contains(BoundingSphere)
Checks whether the current BoundingSphere contains the specified BoundingSphere.
Declaration
public ContainmentType Contains(BoundingSphere sphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere | The BoundingSphere to check against the current BoundingSphere. |
Returns
Type | Description |
---|---|
ContainmentType |
Contains(ref BoundingSphere, out ContainmentType)
Checks whether the current BoundingSphere contains the specified BoundingSphere.
Declaration
public void Contains(ref BoundingSphere sphere, out ContainmentType result)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere | The BoundingSphere to test for overlap. |
ContainmentType | result | [OutAttribute] Enumeration indicating the extent of overlap. |
Contains(Vector3)
Checks whether the current BoundingSphere contains the specified point.
Declaration
public ContainmentType Contains(Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The point to check against the current BoundingSphere. |
Returns
Type | Description |
---|---|
ContainmentType |
Contains(ref Vector3, out ContainmentType)
Checks whether the current BoundingSphere contains the specified point.
Declaration
public void Contains(ref Vector3 point, out ContainmentType result)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | point | The point to test for overlap. |
ContainmentType | result | [OutAttribute] Enumeration indicating the extent of overlap. |
CreateFromBoundingBox(BoundingBox)
Creates the smallest BoundingSphere that can contain a specified BoundingBox.
Declaration
public static BoundingSphere CreateFromBoundingBox(BoundingBox box)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The BoundingBox to create the BoundingSphere from. |
Returns
Type | Description |
---|---|
BoundingSphere |
CreateFromBoundingBox(ref BoundingBox, out BoundingSphere)
Creates the smallest BoundingSphere that can contain a specified BoundingBox.
Declaration
public static void CreateFromBoundingBox(ref BoundingBox box, out BoundingSphere result)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The BoundingBox to create the BoundingSphere from. |
BoundingSphere | result | [OutAttribute] The created BoundingSphere. |
CreateFromFrustum(BoundingFrustum)
Creates the smallest BoundingSphere that can contain a specified BoundingFrustum.
Declaration
public static BoundingSphere CreateFromFrustum(BoundingFrustum frustum)
Parameters
Type | Name | Description |
---|---|---|
BoundingFrustum | frustum | The BoundingFrustum to create the BoundingSphere with. |
Returns
Type | Description |
---|---|
BoundingSphere |
CreateFromPoints(IEnumerable<Vector3>)
Creates a BoundingSphere that can contain a specified list of points.
Declaration
public static BoundingSphere CreateFromPoints(IEnumerable<Vector3> points)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Vector3> | points | List of points the BoundingSphere must contain. |
Returns
Type | Description |
---|---|
BoundingSphere |
CreateInvalid()
Declaration
public static BoundingSphere CreateInvalid()
Returns
Type | Description |
---|---|
BoundingSphere |
CreateMerged(BoundingSphere, BoundingSphere)
Creates a BoundingSphere that contains the two specified BoundingSphere instances.
Declaration
public static BoundingSphere CreateMerged(BoundingSphere original, BoundingSphere additional)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | original | BoundingSphere to be merged. |
BoundingSphere | additional | BoundingSphere to be merged. |
Returns
Type | Description |
---|---|
BoundingSphere |
CreateMerged(ref BoundingSphere, ref BoundingSphere, out BoundingSphere)
Creates a BoundingSphere that contains the two specified BoundingSphere instances.
Declaration
public static void CreateMerged(ref BoundingSphere original, ref BoundingSphere additional, out BoundingSphere result)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | original | BoundingSphere to be merged. |
BoundingSphere | additional | BoundingSphere to be merged. |
BoundingSphere | result | [OutAttribute] The created BoundingSphere. |
Equals(Object)
Determines whether the specified Object is equal to the BoundingSphere.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The Object to compare with the current BoundingSphere. |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(BoundingSphere)
Determines whether the specified BoundingSphere is equal to the current BoundingSphere.
Declaration
public bool Equals(BoundingSphere other)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | other | The BoundingSphere to compare with the current BoundingSphere. |
Returns
Type | Description |
---|---|
System.Boolean |
GetBoundingBox()
Declaration
public BoundingBox GetBoundingBox()
Returns
Type | Description |
---|---|
BoundingBox |
GetHashCode()
Gets the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Include(BoundingSphere)
Declaration
public BoundingSphere Include(BoundingSphere sphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere |
Returns
Type | Description |
---|---|
BoundingSphere |
Include(ref BoundingSphere, ref BoundingSphere)
Declaration
public static void Include(ref BoundingSphere sphere, ref BoundingSphere otherSphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere | |
BoundingSphere | otherSphere |
IntersectRaySphere(Ray, out Single, out Single)
Declaration
public bool IntersectRaySphere(Ray ray, out float tmin, out float tmax)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | |
System.Single | tmin | |
System.Single | tmax |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(BoundingBox)
Checks whether the current BoundingSphere intersects with a specified BoundingBox.
Declaration
public bool Intersects(BoundingBox box)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The BoundingBox to check for intersection with the current BoundingSphere. |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(ref BoundingBox, out Boolean)
Checks whether the current BoundingSphere intersects a BoundingBox.
Declaration
public void Intersects(ref BoundingBox box, out bool result)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | The BoundingBox to check for intersection with. |
System.Boolean | result | [OutAttribute] true if the BoundingSphere and BoundingBox intersect; false otherwise. |
Intersects(BoundingFrustum)
Checks whether the current BoundingSphere intersects with a specified BoundingFrustum.
Declaration
public bool Intersects(BoundingFrustum frustum)
Parameters
Type | Name | Description |
---|---|---|
BoundingFrustum | frustum | The BoundingFrustum to check for intersection with the current BoundingSphere. |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(BoundingSphere)
Checks whether the current BoundingSphere intersects with a specified BoundingSphere.
Declaration
public bool Intersects(BoundingSphere sphere)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere | The BoundingSphere to check for intersection with the current BoundingSphere. |
Returns
Type | Description |
---|---|
System.Boolean |
Intersects(ref BoundingSphere, out Boolean)
Checks whether the current BoundingSphere intersects another BoundingSphere.
Declaration
public void Intersects(ref BoundingSphere sphere, out bool result)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | sphere | The BoundingSphere to check for intersection with. |
System.Boolean | result | [OutAttribute] true if the BoundingSphere instances intersect; false otherwise. |
Intersects(Plane)
Checks whether the current BoundingSphere intersects with a specified Plane.
Declaration
public PlaneIntersectionType Intersects(Plane plane)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The Plane to check for intersection with the current BoundingSphere. |
Returns
Type | Description |
---|---|
PlaneIntersectionType |
Intersects(ref Plane, out PlaneIntersectionType)
Checks whether the current BoundingSphere intersects a Plane.
Declaration
public void Intersects(ref Plane plane, out PlaneIntersectionType result)
Parameters
Type | Name | Description |
---|---|---|
Plane | plane | The Plane to check for intersection with. |
PlaneIntersectionType | result | [OutAttribute] An enumeration indicating whether the BoundingSphere intersects the Plane. |
Intersects(Ray)
Checks whether the current BoundingSphere intersects with a specified Ray.
Declaration
public Nullable<float> Intersects(Ray ray)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The Ray to check for intersection with the current BoundingSphere. |
Returns
Type | Description |
---|---|
System.Nullable<System.Single> |
Intersects(ref Ray, out Nullable<Single>)
Checks whether the current BoundingSphere intersects a Ray.
Declaration
public void Intersects(ref Ray ray, out Nullable<float> result)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The Ray to check for intersection with. |
System.Nullable<System.Single> | result | [OutAttribute] Distance at which the ray intersects the BoundingSphere or null if there is no intersection. |
ToString()
Returns a String that represents the current BoundingSphere.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Transform(Matrix)
Translates and scales the BoundingSphere using a given Matrix.
Declaration
public BoundingSphere Transform(Matrix matrix)
Parameters
Type | Name | Description |
---|---|---|
Matrix | 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. |
Returns
Type | Description |
---|---|
BoundingSphere |
Transform(ref Matrix, out BoundingSphere)
Translates and scales the BoundingSphere using a given Matrix.
Declaration
public void Transform(ref Matrix matrix, out BoundingSphere result)
Parameters
Type | Name | Description |
---|---|---|
Matrix | 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. |
BoundingSphere | result | [OutAttribute] The transformed BoundingSphere. |
Translate(ref Vector3)
Declaration
public BoundingSphere Translate(ref Vector3 translation)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | translation |
Returns
Type | Description |
---|---|
BoundingSphere |
Operators
Equality(BoundingSphere, BoundingSphere)
Determines whether two instances of BoundingSphere are equal.
Declaration
public static bool operator ==(BoundingSphere a, BoundingSphere b)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | a | The object to the left of the equality operator. |
BoundingSphere | b | The object to the right of the equality operator. |
Returns
Type | Description |
---|---|
System.Boolean |
Inequality(BoundingSphere, BoundingSphere)
Determines whether two instances of BoundingSphere are not equal.
Declaration
public static bool operator !=(BoundingSphere a, BoundingSphere b)
Parameters
Type | Name | Description |
---|---|---|
BoundingSphere | a | The BoundingSphere to the left of the inequality operator. |
BoundingSphere | b | The BoundingSphere to the right of the inequality operator. |
Returns
Type | Description |
---|---|
System.Boolean |