Struct BoundingSphere
Describes a sphere in 3D-space for bounding operations.
[DataContract]
public struct BoundingSphere : IEquatable<BoundingSphere>
- Implements
- Inherited Members
Constructors
BoundingSphere(Vector3, float)
Constructs a bounding sphere with the specified center and radius.
public BoundingSphere(Vector3 center, float radius)
Parameters
Fields
Center
The sphere center.
[DataMember]
public Vector3 Center
Field Value
Radius
The sphere radius.
[DataMember]
public float Radius
Field Value
Methods
Contains(BoundingBox)
Test if a bounding box is fully inside, outside, or just intersecting the sphere.
public ContainmentType Contains(BoundingBox box)
Parameters
box
BoundingBoxThe box for testing.
Returns
- ContainmentType
The containment type.
Contains(ref BoundingBox, out ContainmentType)
Test if a bounding box is fully inside, outside, or just intersecting the sphere.
public void Contains(ref BoundingBox box, out ContainmentType result)
Parameters
box
BoundingBoxThe box for testing.
result
ContainmentTypeThe containment type as an output parameter.
Contains(BoundingFrustum)
Test if a frustum is fully inside, outside, or just intersecting the sphere.
public ContainmentType Contains(BoundingFrustum frustum)
Parameters
frustum
BoundingFrustumThe frustum for testing.
Returns
- ContainmentType
The containment type.
Contains(ref BoundingFrustum, out ContainmentType)
Test if a frustum is fully inside, outside, or just intersecting the sphere.
public void Contains(ref BoundingFrustum frustum, out ContainmentType result)
Parameters
frustum
BoundingFrustumThe frustum for testing.
result
ContainmentTypeThe containment type as an output parameter.
Contains(BoundingSphere)
Test if a sphere is fully inside, outside, or just intersecting the sphere.
public ContainmentType Contains(BoundingSphere sphere)
Parameters
sphere
BoundingSphereThe other sphere for testing.
Returns
- ContainmentType
The containment type.
Contains(ref BoundingSphere, out ContainmentType)
Test if a sphere is fully inside, outside, or just intersecting the sphere.
public void Contains(ref BoundingSphere sphere, out ContainmentType result)
Parameters
sphere
BoundingSphereThe other sphere for testing.
result
ContainmentTypeThe containment type as an output parameter.
Contains(Vector3)
Test if a point is fully inside, outside, or just intersecting the sphere.
public ContainmentType Contains(Vector3 point)
Parameters
point
Vector3The vector in 3D-space for testing.
Returns
- ContainmentType
The containment type.
Contains(ref Vector3, out ContainmentType)
Test if a point is fully inside, outside, or just intersecting the sphere.
public void Contains(ref Vector3 point, out ContainmentType result)
Parameters
point
Vector3The vector in 3D-space for testing.
result
ContainmentTypeThe containment type as an output parameter.
CreateFromBoundingBox(BoundingBox)
Creates the smallest BoundingSphere that can contain a specified BoundingBox.
public static BoundingSphere CreateFromBoundingBox(BoundingBox box)
Parameters
box
BoundingBoxThe box to create the sphere from.
Returns
- BoundingSphere
The new BoundingSphere.
CreateFromBoundingBox(ref BoundingBox, out BoundingSphere)
Creates the smallest BoundingSphere that can contain a specified BoundingBox.
public static void CreateFromBoundingBox(ref BoundingBox box, out BoundingSphere result)
Parameters
box
BoundingBoxThe box to create the sphere from.
result
BoundingSphereThe new BoundingSphere as an output parameter.
CreateFromFrustum(BoundingFrustum)
Creates the smallest BoundingSphere that can contain a specified BoundingFrustum.
public static BoundingSphere CreateFromFrustum(BoundingFrustum frustum)
Parameters
frustum
BoundingFrustumThe frustum to create the sphere from.
Returns
- BoundingSphere
The new BoundingSphere.
CreateFromPoints(IEnumerable<Vector3>)
Creates the smallest BoundingSphere that can contain a specified list of points in 3D-space.
public static BoundingSphere CreateFromPoints(IEnumerable<Vector3> points)
Parameters
points
IEnumerable<Vector3>List of point to create the sphere from.
Returns
- BoundingSphere
The new BoundingSphere.
CreateMerged(BoundingSphere, BoundingSphere)
Creates the smallest BoundingSphere that can contain two spheres.
public static BoundingSphere CreateMerged(BoundingSphere original, BoundingSphere additional)
Parameters
original
BoundingSphereFirst sphere.
additional
BoundingSphereSecond sphere.
Returns
- BoundingSphere
The new BoundingSphere.
CreateMerged(ref BoundingSphere, ref BoundingSphere, out BoundingSphere)
Creates the smallest BoundingSphere that can contain two spheres.
public static void CreateMerged(ref BoundingSphere original, ref BoundingSphere additional, out BoundingSphere result)
Parameters
original
BoundingSphereFirst sphere.
additional
BoundingSphereSecond sphere.
result
BoundingSphereThe new BoundingSphere as an output parameter.
Deconstruct(out Vector3, out float)
Deconstruction method for BoundingSphere.
public void Deconstruct(out Vector3 center, out float radius)
Parameters
Equals(BoundingSphere)
Compares whether current instance is equal to specified BoundingSphere.
public bool Equals(BoundingSphere other)
Parameters
other
BoundingSphereThe BoundingSphere to compare.
Returns
- bool
true
if the instances are equal;false
otherwise.
Equals(object)
Compares whether current instance is equal to specified object.
public override bool Equals(object obj)
Parameters
Returns
- bool
true
if the instances are equal;false
otherwise.
GetHashCode()
Gets the hash code of this BoundingSphere.
public override int GetHashCode()
Returns
- int
Hash code of this BoundingSphere.
Intersects(BoundingBox)
Gets whether or not a specified BoundingBox intersects with this sphere.
public bool Intersects(BoundingBox box)
Parameters
box
BoundingBoxThe box for testing.
Returns
- bool
true
if BoundingBox intersects with this sphere;false
otherwise.
Intersects(ref BoundingBox, out bool)
Gets whether or not a specified BoundingBox intersects with this sphere.
public void Intersects(ref BoundingBox box, out bool result)
Parameters
box
BoundingBoxThe box for testing.
result
booltrue
if BoundingBox intersects with this sphere;false
otherwise. As an output parameter.
Intersects(BoundingSphere)
Gets whether or not the other BoundingSphere intersects with this sphere.
public bool Intersects(BoundingSphere sphere)
Parameters
sphere
BoundingSphereThe other sphere for testing.
Returns
- bool
true
if other BoundingSphere intersects with this sphere;false
otherwise.
Intersects(ref BoundingSphere, out bool)
Gets whether or not the other BoundingSphere intersects with this sphere.
public void Intersects(ref BoundingSphere sphere, out bool result)
Parameters
sphere
BoundingSphereThe other sphere for testing.
result
booltrue
if other BoundingSphere intersects with this sphere;false
otherwise. As an output parameter.
Intersects(Plane)
Gets whether or not a specified Plane intersects with this sphere.
public PlaneIntersectionType Intersects(Plane plane)
Parameters
plane
PlaneThe plane for testing.
Returns
- PlaneIntersectionType
Type of intersection.
Intersects(ref Plane, out PlaneIntersectionType)
Gets whether or not a specified Plane intersects with this sphere.
public void Intersects(ref Plane plane, out PlaneIntersectionType result)
Parameters
plane
PlaneThe plane for testing.
result
PlaneIntersectionTypeType of intersection as an output parameter.
Intersects(Ray)
Gets whether or not a specified Ray intersects with this sphere.
public float? Intersects(Ray ray)
Parameters
ray
RayThe ray for testing.
Returns
- float?
Distance of ray intersection or
null
if there is no intersection.
Intersects(ref Ray, out float?)
Gets whether or not a specified Ray intersects with this sphere.
public void Intersects(ref Ray ray, out float? result)
Parameters
ray
RayThe ray for testing.
result
float?Distance of ray intersection or
null
if there is no intersection as an output parameter.
ToString()
Returns a string representation of this BoundingSphere in the format: {Center:[Center] Radius:[Radius]}
public override string ToString()
Returns
- string
A string representation of this BoundingSphere.
Transform(Matrix)
Creates a new BoundingSphere that contains a transformation of translation and scale from this sphere by the specified Matrix.
public BoundingSphere Transform(Matrix matrix)
Parameters
Returns
- BoundingSphere
Transformed BoundingSphere.
Transform(ref Matrix, out BoundingSphere)
Creates a new BoundingSphere that contains a transformation of translation and scale from this sphere by the specified Matrix.
public void Transform(ref Matrix matrix, out BoundingSphere result)
Parameters
matrix
MatrixThe transformation Matrix.
result
BoundingSphereTransformed BoundingSphere as an output parameter.
Operators
operator ==(BoundingSphere, BoundingSphere)
Compares whether two BoundingSphere instances are equal.
public static bool operator ==(BoundingSphere a, BoundingSphere b)
Parameters
a
BoundingSphereBoundingSphere instance on the left of the equal sign.
b
BoundingSphereBoundingSphere instance on the right of the equal sign.
Returns
- bool
true
if the instances are equal;false
otherwise.
operator !=(BoundingSphere, BoundingSphere)
Compares whether two BoundingSphere instances are not equal.
public static bool operator !=(BoundingSphere a, BoundingSphere b)
Parameters
a
BoundingSphereBoundingSphere instance on the left of the not equal sign.
b
BoundingSphereBoundingSphere instance on the right of the not equal sign.
Returns
- bool
true
if the instances are not equal;false
otherwise.