Struct BoundingSphere
A bounding sphere object.
Implements
Inherited Members
Namespace: JeremyAnsel.DirectX.DXMath.Collision
Assembly: JeremyAnsel.DirectX.DXMath.dll
Syntax
public struct BoundingSphere : IEquatable<BoundingSphere>
Constructors
| Edit this page View SourceBoundingSphere(XMFloat3, float)
Initializes a new instance of the BoundingSphere struct.
Declaration
public BoundingSphere(XMFloat3 center, float radius)
Parameters
| Type | Name | Description |
|---|---|---|
| XMFloat3 | center | The center. |
| float | radius | The radius. |
Properties
| Edit this page View SourceCenter
Gets or sets the center of the BoundingSphere.
Declaration
public XMFloat3 Center { get; set; }
Property Value
| Type | Description |
|---|---|
| XMFloat3 |
Radius
Gets or sets the radius of the BoundingSphere.
Declaration
public float Radius { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
| Edit this page View SourceContainedBy(XMVector, XMVector, XMVector, XMVector, XMVector, XMVector)
Tests whether the BoundingSphere is contained by the specified frustum.
Declaration
public ContainmentType ContainedBy(XMVector plane0, XMVector plane1, XMVector plane2, XMVector plane3, XMVector plane4, XMVector plane5)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | plane0 | The first plane describing the frustum. |
| XMVector | plane1 | The second plane describing the frustum. |
| XMVector | plane2 | The third plane describing the frustum. |
| XMVector | plane3 | The fourth plane describing the frustum. |
| XMVector | plane4 | The fifth plane describing the frustum. |
| XMVector | plane5 | The sixth plane describing the frustum. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the frustum contains the BoundingSphere. |
ContainedBy(XMVector[]?)
Tests whether the BoundingSphere is contained by the specified frustum.
Declaration
public ContainmentType ContainedBy(XMVector[]? planes)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector[] | planes | The planes describing the frustum. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the frustum contains the BoundingSphere. |
Contains(BoundingBox)
Tests whether the BoundingSphere contains a specified BoundingBox.
Declaration
public ContainmentType Contains(BoundingBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingBox | box | The BoundingBox to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingSphere contains the specified BoundingBox. |
Contains(BoundingFrustum)
Tests whether the BoundingSphere contains the specified BoundingFrustum.
Declaration
public ContainmentType Contains(BoundingFrustum fr)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingFrustum | fr | The BoundingFrustum to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingFrustum is contained in the BoundingSphere. |
Contains(BoundingOrientedBox)
Tests whether the BoundingSphere contains the specified BoundingOrientedBox.
Declaration
public ContainmentType Contains(BoundingOrientedBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingOrientedBox | box | The BoundingOrientedBox to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingOrientedBox is contained in the BoundingSphere. |
Contains(BoundingSphere)
Tests whether the BoundingSphere contains a specified BoundingSphere.
Declaration
public ContainmentType Contains(BoundingSphere sh)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingSphere | sh | The BoundingSphere to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingSphere contains the specified BoundingSphere. |
Contains(XMVector)
Tests whether the BoundingSphere contains a specified point.
Declaration
public ContainmentType Contains(XMVector point)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | point | The point to test against. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingSphere contains the specified point. |
Contains(XMVector, XMVector, XMVector)
Tests whether the BoundingSphere contains a specified triangle.
Declaration
public ContainmentType Contains(XMVector v0, XMVector v1, XMVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | v0 | The first corner of the triangle. |
| XMVector | v1 | The second corner of the triangle. |
| XMVector | v2 | The third corner of the triangle. |
Returns
| Type | Description |
|---|---|
| ContainmentType | A ContainmentType value indicating whether the BoundingSphere contains the specified triangle. |
CreateFromBox(BoundingBox)
Creates a BoundingSphere containing the specified BoundingBox.
Declaration
public static BoundingSphere CreateFromBox(BoundingBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingBox | box | The BoundingBox the new BoundingSphere should contain. |
Returns
| Type | Description |
|---|---|
| BoundingSphere | The new BoundingSphere. |
CreateFromFrustum(BoundingFrustum)
Creates a BoundingSphere containing the specified BoundingFrustum.
Declaration
public static BoundingSphere CreateFromFrustum(BoundingFrustum fr)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingFrustum | fr | The BoundingFrustum the new BoundingSphere should contain. |
Returns
| Type | Description |
|---|---|
| BoundingSphere | The new BoundingSphere. |
CreateFromOrientedBox(BoundingOrientedBox)
Creates a BoundingSphere containing the specified BoundingOrientedBox.
Declaration
public static BoundingSphere CreateFromOrientedBox(BoundingOrientedBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingOrientedBox | box | The BoundingOrientedBox the new BoundingSphere should contain. |
Returns
| Type | Description |
|---|---|
| BoundingSphere | The new BoundingSphere. |
CreateFromPoints(XMFloat3[]?)
Creates a new BoundingSphere from a list of points.
Declaration
public static BoundingSphere CreateFromPoints(XMFloat3[]? points)
Parameters
| Type | Name | Description |
|---|---|---|
| XMFloat3[] | points | The points to create the new BoundingSphere from. |
Returns
| Type | Description |
|---|---|
| BoundingSphere | The new BoundingSphere containing the specified points. |
CreateMerged(BoundingSphere, BoundingSphere)
Creates a BoundingSphere that contains the two specified BoundingSphere objects.
Declaration
public static BoundingSphere CreateMerged(BoundingSphere s1, BoundingSphere s2)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingSphere | s1 | The first BoundingSphere that the new BoundingSphere should contain. |
| BoundingSphere | s2 | The second BoundingSphere that the new BoundingSphere should contain. |
Returns
| Type | Description |
|---|---|
| BoundingSphere | A new BoundingSphere containing the two specified BoundingSphere objects. |
Equals(BoundingSphere)
Determines whether the specified object is equal to the current object.
Declaration
public bool Equals(BoundingSphere other)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingSphere | other | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceGetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
| Edit this page View SourceIntersects(BoundingBox)
Tests the BoundingSphere for intersection with a BoundingBox.
Declaration
public bool Intersects(BoundingBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingBox | box | The BoundingBox to test against. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingSphere intersects the specified BoundingBox. |
Intersects(BoundingFrustum)
Test the BoundingSphere for intersection with a BoundingFrustum.
Declaration
public bool Intersects(BoundingFrustum fr)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingFrustum | fr | The BoundingFrustum to test for intersection. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingSphere intersects the specified BoundingFrustum. |
Intersects(BoundingOrientedBox)
Test the BoundingSphere for intersection with a BoundingOrientedBox.
Declaration
public bool Intersects(BoundingOrientedBox box)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingOrientedBox | box | The BoundingOrientedBox to test for intersection. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingSphere intersects the specified BoundingOrientedBox. |
Intersects(BoundingSphere)
Tests the BoundingSphere for intersection with a BoundingSphere.
Declaration
public bool Intersects(BoundingSphere sh)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingSphere | sh | The BoundingSphere to test against. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingSphere intersects the specified BoundingSphere. |
Intersects(XMVector)
Tests the BoundingSphere for intersection with a plane.
Declaration
public PlaneIntersectionType Intersects(XMVector plane)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | plane | A vector describing the plane. |
Returns
| Type | Description |
|---|---|
| PlaneIntersectionType | A PlaneIntersectionType value indicating whether the BoundingSphere intersects the specified plane. |
Intersects(XMVector, XMVector)
Tests the BoundingSphere for intersection with a ray.
Declaration
public bool Intersects(XMVector origin, XMVector direction)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | origin | The origin of the ray. |
| XMVector | direction | The direction of the ray. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingSphere contains the specified ray. |
Intersects(XMVector, XMVector, XMVector)
Tests the BoundingSphere for intersection with a triangle.
Declaration
public bool Intersects(XMVector v0, XMVector v1, XMVector v2)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | v0 | The first corner of the triangle. |
| XMVector | v1 | The second corner of the triangle. |
| XMVector | v2 | The third corner of the triangle. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingSphere intersects the specified triangle. |
Intersects(XMVector, XMVector, out float)
Tests the BoundingSphere for intersection with a ray.
Declaration
public bool Intersects(XMVector origin, XMVector direction, out float distance)
Parameters
| Type | Name | Description |
|---|---|---|
| XMVector | origin | The origin of the ray. |
| XMVector | direction | The direction of the ray. |
| float | distance | The length of the ray. |
Returns
| Type | Description |
|---|---|
| bool | A boolean value indicating whether the BoundingSphere contains the specified ray. |
Transform(XMMatrix)
Transforms the BoundingSphere.
Declaration
public BoundingSphere Transform(XMMatrix m)
Parameters
| Type | Name | Description |
|---|---|---|
| XMMatrix | m | The transformation matrix. |
Returns
| Type | Description |
|---|---|
| BoundingSphere | The transformed BoundingSphere. |
Transform(float, XMVector, XMVector)
Transforms the BoundingSphere using the specified scale, rotation and translation vectors.
Declaration
public BoundingSphere Transform(float scale, XMVector rotation, XMVector translation)
Parameters
| Type | Name | Description |
|---|---|---|
| float | scale | The value to scale the BoundingSphere by. |
| XMVector | rotation | The value to rotate the BoundingSphere by. |
| XMVector | translation | The value to translate the BoundingSphere by. |
Returns
| Type | Description |
|---|---|
| BoundingSphere | The transformed BoundingSphere. |
Operators
| Edit this page View Sourceoperator ==(BoundingSphere, BoundingSphere)
Compares two BoundingSphere objects. The result specifies whether the values of the two objects are equal.
Declaration
public static bool operator ==(BoundingSphere left, BoundingSphere right)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingSphere | left | The left BoundingSphere to compare. |
| BoundingSphere | right | The right BoundingSphere to compare. |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(BoundingSphere, BoundingSphere)
Compares two BoundingSphere objects. The result specifies whether the values of the two objects are unequal.
Declaration
public static bool operator !=(BoundingSphere left, BoundingSphere right)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundingSphere | left | The left BoundingSphere to compare. |
| BoundingSphere | right | The right BoundingSphere to compare. |
Returns
| Type | Description |
|---|---|
| bool |