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
boxBoundingBoxThe 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
boxBoundingBoxThe box for testing.
resultContainmentTypeThe 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
frustumBoundingFrustumThe 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
frustumBoundingFrustumThe frustum for testing.
resultContainmentTypeThe 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
sphereBoundingSphereThe 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
sphereBoundingSphereThe other sphere for testing.
resultContainmentTypeThe 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
pointVector3The 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
pointVector3The vector in 3D-space for testing.
resultContainmentTypeThe 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
boxBoundingBoxThe 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
boxBoundingBoxThe box to create the sphere from.
resultBoundingSphereThe 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
frustumBoundingFrustumThe 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
pointsIEnumerable<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
originalBoundingSphereFirst sphere.
additionalBoundingSphereSecond 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
originalBoundingSphereFirst sphere.
additionalBoundingSphereSecond sphere.
resultBoundingSphereThe 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
otherBoundingSphereThe BoundingSphere to compare.
Returns
- bool
trueif the instances are equal;falseotherwise.
Equals(object)
Compares whether current instance is equal to specified object.
public override bool Equals(object obj)
Parameters
Returns
- bool
trueif the instances are equal;falseotherwise.
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
boxBoundingBoxThe box for testing.
Returns
- bool
trueif BoundingBox intersects with this sphere;falseotherwise.
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
boxBoundingBoxThe box for testing.
resultbooltrueif BoundingBox intersects with this sphere;falseotherwise. As an output parameter.
Intersects(BoundingSphere)
Gets whether or not the other BoundingSphere intersects with this sphere.
public bool Intersects(BoundingSphere sphere)
Parameters
sphereBoundingSphereThe other sphere for testing.
Returns
- bool
trueif other BoundingSphere intersects with this sphere;falseotherwise.
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
sphereBoundingSphereThe other sphere for testing.
resultbooltrueif other BoundingSphere intersects with this sphere;falseotherwise. As an output parameter.
Intersects(Plane)
Gets whether or not a specified Plane intersects with this sphere.
public PlaneIntersectionType Intersects(Plane plane)
Parameters
planePlaneThe 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
planePlaneThe plane for testing.
resultPlaneIntersectionTypeType 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
rayRayThe ray for testing.
Returns
- float?
Distance of ray intersection or
nullif 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
rayRayThe ray for testing.
resultfloat?Distance of ray intersection or
nullif 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
matrixMatrixThe transformation Matrix.
resultBoundingSphereTransformed 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
aBoundingSphereBoundingSphere instance on the left of the equal sign.
bBoundingSphereBoundingSphere instance on the right of the equal sign.
Returns
- bool
trueif the instances are equal;falseotherwise.
operator !=(BoundingSphere, BoundingSphere)
Compares whether two BoundingSphere instances are not equal.
public static bool operator !=(BoundingSphere a, BoundingSphere b)
Parameters
aBoundingSphereBoundingSphere instance on the left of the not equal sign.
bBoundingSphereBoundingSphere instance on the right of the not equal sign.
Returns
- bool
trueif the instances are not equal;falseotherwise.