Class BoundingSphere
Represents a bounding sphere in three dimensional space.
Inheritance
Implements
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class BoundingSphere : ValueType, IEquatable<BoundingSphere>, IFormattable
Constructors
BoundingSphere(Vector3, Single)
Initializes a new instance of the BoundingBox struct.
Declaration
public BoundingSphere(Vector3 center, float radius)
Parameters
Vector3
center
The center of the sphere in three dimensional space. 
System.Single
radius
The radius of the sphere. 
Fields
Center
The center of the sphere in three dimensional space.
Declaration
public Vector3 Center
Field Value
Vector3

Empty
A BoundingSphere which represents an empty space.
Declaration
public static readonly BoundingSphere Empty
Field Value
BoundingSphere

Radius
The radius of the sphere.
Declaration
public float Radius
Field Value
System.Single

Properties
Default
The default BoundingSphere.
Declaration
public static BoundingSphere Default { get; }
Property Value
BoundingSphere

Methods
Contains(ref BoundingBox)
Determines whether the current objects contains a BoundingBox.
Declaration
public ContainmentType Contains(ref BoundingBox box)
Parameters
BoundingBox
box
The box to test. 
Returns
ContainmentType
The type of containment the two objects have. 
Contains(ref BoundingSphere)
Determines whether the current objects contains a BoundingSphere.
Declaration
public ContainmentType Contains(ref BoundingSphere sphere)
Parameters
BoundingSphere
sphere
The sphere to test. 
Returns
ContainmentType
The type of containment the two objects have. 
Contains(ref Vector3)
Determines whether the current objects contains a point.
Declaration
public ContainmentType Contains(ref Vector3 point)
Parameters
Vector3
point
The point to test. 
Returns
ContainmentType
The type of containment the two objects have. 
Contains(ref Vector3, ref Vector3, ref Vector3)
Determines whether the current objects contains a triangle.
Declaration
public ContainmentType Contains(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
Parameters
Vector3
vertex1
The first vertex of the triangle to test. 
Vector3
vertex2
The second vertex of the triangle to test. 
Vector3
vertex3
The third vertex of the triangle to test. 
Returns
ContainmentType
The type of containment the two objects have. 
Equals(BoundingSphere)
Determines whether the specified Vector4 is equal to this instance.
Declaration
public bool Equals(BoundingSphere value)
Parameters
BoundingSphere
value
The Vector4 to compare with this instance. 
Returns
System.Boolean

Equals(ref BoundingSphere)
Determines whether the specified Vector4 is equal to this instance.
Declaration
public bool Equals(ref BoundingSphere value)
Parameters
BoundingSphere
value
The Vector4 to compare with this instance. 
Returns
System.Boolean

Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object value)
Parameters
System.Object
value
The System.Object to compare with this instance. 
Returns
System.Boolean

FromBox(BoundingBox)
Constructs a BoundingSphere from a given box.
Declaration
public static BoundingSphere FromBox(BoundingBox box)
Parameters
BoundingBox
box
The box that will designate the extents of the sphere. 
Returns
BoundingSphere
The newly constructed bounding sphere. 
FromBox(ref BoundingBox, out BoundingSphere)
Constructs a BoundingSphere from a given box.
Declaration
public static void FromBox(ref BoundingBox box, out BoundingSphere result)
Parameters
BoundingBox
box
The box that will designate the extents of the sphere. 
BoundingSphere
result
When the method completes, the newly constructed bounding sphere. 
FromPoints(Vector3[])
Constructs a BoundingSphere that fully contains the given points.
Declaration
public static BoundingSphere FromPoints(Vector3[] points)
Parameters
Vector3[]
points
The points that will be contained by the sphere. 
Returns
BoundingSphere
The newly constructed bounding sphere. 
FromPoints(Vector3[], out BoundingSphere)
Constructs a BoundingSphere that fully contains the given points.
Declaration
public static void FromPoints(Vector3[] points, out BoundingSphere result)
Parameters
Vector3[]
points
The points that will be contained by the sphere. 
BoundingSphere
result
When the method completes, contains the newly constructed bounding sphere. 
FromPoints(Vector3[], Int32, Int32, out BoundingSphere)
Constructs a BoundingSphere that fully contains the given points.
Declaration
public static void FromPoints(Vector3[] points, int start, int count, out BoundingSphere result)
Parameters
Vector3[]
points
The points that will be contained by the sphere. 
System.Int32
start
The start index from points array to start compute the bounding sphere. 
System.Int32
count
The count of points to process to compute the bounding sphere. 
BoundingSphere
result
When the method completes, contains the newly constructed bounding sphere. 
Exceptions
System.ArgumentNullException
points 
System.ArgumentOutOfRangeException
start or count 
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
System.Int32
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. 
Intersects(BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
Declaration
public bool Intersects(BoundingBox box)
Parameters
BoundingBox
box
The box to test. 
Returns
System.Boolean
Whether the two objects intersected. 
Intersects(ref BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
Declaration
public bool Intersects(ref BoundingBox box)
Parameters
BoundingBox
box
The box to test. 
Returns
System.Boolean
Whether the two objects intersected. 
Intersects(BoundingSphere)
Determines if there is an intersection between the current object and a BoundingSphere.
Declaration
public bool Intersects(BoundingSphere sphere)
Parameters
BoundingSphere
sphere
The sphere to test. 
Returns
System.Boolean
Whether the two objects intersected. 
Intersects(ref BoundingSphere)
Determines if there is an intersection between the current object and a BoundingSphere.
Declaration
public bool Intersects(ref BoundingSphere sphere)
Parameters
BoundingSphere
sphere
The sphere to test. 
Returns
System.Boolean
Whether the two objects intersected. 
Intersects(ref Plane)
Determines if there is an intersection between the current object and a Plane.
Declaration
public PlaneIntersectionType Intersects(ref Plane plane)
Parameters
Plane
plane
The plane to test. 
Returns
PlaneIntersectionType
Whether the two objects intersected. 
Intersects(ref Ray)
Determines if there is an intersection between the current object and a Ray.
Declaration
public bool Intersects(ref Ray ray)
Parameters
Ray
ray
The ray to test. 
Returns
System.Boolean
Whether the two objects intersected. 
Intersects(ref Ray, out Vector3)
Determines if there is an intersection between the current object and a Ray.
Declaration
public bool Intersects(ref Ray ray, out Vector3 point)
Parameters
Ray
ray
The ray to test. 
Vector3
point
When the method completes, contains the point of intersection, or Zero if there was no intersection. 
Returns
System.Boolean
Whether the two objects intersected. 
Intersects(ref Ray, out Single)
Determines if there is an intersection between the current object and a Ray.
Declaration
public bool Intersects(ref Ray ray, out float distance)
Parameters
Ray
ray
The ray to test. 
System.Single
distance
When the method completes, contains the distance of the intersection, or 0 if there was no intersection. 
Returns
System.Boolean
Whether the two objects intersected. 
Intersects(ref Vector3, ref Vector3, ref Vector3)
Determines if there is an intersection between the current object and a triangle.
Declaration
public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
Parameters
Vector3
vertex1
The first vertex of the triangle to test. 
Vector3
vertex2
The second vertex of the triangle to test. 
Vector3
vertex3
The third vertex of the triangle to test. 
Returns
System.Boolean
Whether the two objects intersected. 
Merge(BoundingSphere, BoundingSphere)
Constructs a BoundingSphere that is the as large as the total combined area of the two specified spheres.
Declaration
public static BoundingSphere Merge(BoundingSphere value1, BoundingSphere value2)
Parameters
BoundingSphere
value1
The first sphere to merge. 
BoundingSphere
value2
The second sphere to merge. 
Returns
BoundingSphere
The newly constructed bounding sphere. 
Merge(ref BoundingSphere, ref BoundingSphere, out BoundingSphere)
Constructs a BoundingSphere that is the as large as the total combined area of the two specified spheres.
Declaration
public static void Merge(ref BoundingSphere value1, ref BoundingSphere value2, out BoundingSphere result)
Parameters
BoundingSphere
value1
The first sphere to merge. 
BoundingSphere
value2
The second sphere to merge. 
BoundingSphere
result
When the method completes, contains the newly constructed bounding sphere. 
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
System.String
A System.String that represents this instance. 
ToString(IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
System.IFormatProvider
formatProvider
The format provider. 
Returns
System.String
A System.String that represents this instance. 
ToString(String)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format)
Parameters
System.String
format
The format. 
Returns
System.String
A System.String that represents this instance. 
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
System.String
format
The format. 
System.IFormatProvider
formatProvider
The format provider. 
Returns
System.String
A System.String that represents this instance. 
Transform(BoundingSphere, Matrix)
Transforms the bounding sphere using the specified matrix.
Declaration
public static BoundingSphere Transform(BoundingSphere sphere, Matrix matrix)
Parameters
BoundingSphere
sphere
The sphere. 
Matrix
matrix
The matrix. 
Returns
BoundingSphere

Remarks
The result transformed sphere.
Transform(ref BoundingSphere, ref Matrix, out BoundingSphere)
Transforms the bounding sphere using the specified matrix.
Declaration
public static void Transform(ref BoundingSphere sphere, ref Matrix matrix, out BoundingSphere result)
Parameters
BoundingSphere
sphere
The sphere. 
Matrix
matrix
The matrix. 
BoundingSphere
result
The result transformed sphere. 
Operators
Equality(BoundingSphere, BoundingSphere)
Tests for equality between two objects.
Declaration
public static bool operator ==(BoundingSphere left, BoundingSphere right)
Parameters
BoundingSphere
left
The first value to compare. 
BoundingSphere
right
The second value to compare. 
Returns
System.Boolean

Inequality(BoundingSphere, BoundingSphere)
Tests for inequality between two objects.
Declaration
public static bool operator !=(BoundingSphere left, BoundingSphere right)
Parameters
BoundingSphere
left
The first value to compare. 
BoundingSphere
right
The second value to compare. 
Returns
System.Boolean
