Struct BoundingSphere
Represents a bounding sphere in three dimensional space.
Assembly: FlaxEngine.dll
File: Engine/Core/Math/BoundingSphere.h
Syntax
public struct BoundingSphere
Constructors
BoundingSphere()
Empty constructor.
Declaration
public BoundingSphere() = default
BoundingSphere(const Vector3& center, Real radius)
Initializes a new instance of the Bounding
Declaration
public BoundingSphere(const Vector3& center, Real radius)
Parameters
Vector3
center
The center of the sphere in three dimensional space. |
Real
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
An empty bounding sphere (Center = 0 and Radius = 0).
Declaration
public static BoundingSphere Empty
Field Value
Radius
The radius of the sphere.
Declaration
public Real Radius
Field Value
Real
|
Methods
Contains(const BoundingBox& box)
Determines whether sphere contains a box.
Declaration
public ContainmentType Contains(const BoundingBox& box) const
Parameters
Bounding The box to test. |
Returns
Containment The type of containment the two objects have. |
Contains(const BoundingSphere& sphere)
Determines whether sphere contains a sphere.
Declaration
public ContainmentType Contains(const BoundingSphere& sphere) const
Parameters
Bounding The sphere to test. |
Returns
Containment The type of containment the two objects have. |
Contains(const Vector3& point)
Determines whether sphere contains a point.
Declaration
public ContainmentType Contains(const Vector3& point) const
Parameters
Vector3
point
The point to test. |
Returns
Containment The type of containment the two objects have. |
Contains(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)
Determines whether sphere contains a triangle.
Declaration
public ContainmentType Contains(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3) const
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
Containment The type of containment the two objects have. |
FromBox(const BoundingBox& box, BoundingSphere& result)
Constructs a Bounding Sphere from a given box.
Declaration
public static void FromBox(const BoundingBox& box, BoundingSphere& result)
Parameters
Bounding The box that will designate the extents of the sphere. |
Bounding When the method completes, the newly constructed bounding sphere. |
FromPoints(const Double3* points, int32 pointsCount, BoundingSphere& result)
Constructs a BoundingSphere that fully contains the given points
Declaration
public static void FromPoints(const Double3* points, int32 pointsCount, BoundingSphere& result)
Parameters
Double3
points
The points that will be contained by the sphere. |
int32
pointsCount
The amount of points to use. |
Bounding When the method completes, contains the newly constructed bounding sphere. |
FromPoints(const Float3* points, int32 pointsCount, BoundingSphere& result)
Constructs a BoundingSphere that fully contains the given points
Declaration
public static void FromPoints(const Float3* points, int32 pointsCount, BoundingSphere& result)
Parameters
Float3
points
The points that will be contained by the sphere. |
int32
pointsCount
The amount of points to use. |
Bounding When the method completes, contains the newly constructed bounding sphere. |
GetBoundingBox()
Gets the box which contains whole sphere.
Declaration
public BoundingBox GetBoundingBox() const
Returns
Bounding The box. |
GetBoundingBox(BoundingBox& result)
Gets the box which contains whole sphere.
Declaration
public void GetBoundingBox(BoundingBox& result) const
Parameters
Bounding The result box. |
Intersects(const BoundingBox& box)
Determines if there is an intersection between sphere and a box.
Declaration
public bool Intersects(const BoundingBox& box) const
Parameters
Bounding The box to test. |
Returns
bool
Whether the two objects intersected. |
Intersects(const BoundingSphere& sphere)
Determines if there is an intersection between two spheres.
Declaration
public bool Intersects(const BoundingSphere& sphere) const
Parameters
Bounding The sphere to test. |
Returns
bool
Whether the two objects intersected. |
Intersects(const Plane& plane)
Determines if there is an intersection between sphere and a plane.
Declaration
public PlaneIntersectionType Intersects(const Plane& plane) const
Parameters
Plane
plane
The plane to test. |
Returns
Plane Whether the two objects intersected. |
Intersects(const Ray& ray)
Determines if there is an intersection between sphere and a rat.
Declaration
public bool Intersects(const Ray& ray) const
Parameters
Ray
ray
The ray to test. |
Returns
bool
Whether the two objects intersected. |
Intersects(const Ray& ray, Real& distance)
Determines if there is an intersection between sphere and a rat.
Declaration
public bool Intersects(const Ray& ray, Real& distance) const
Parameters
Ray
ray
The ray to test. |
Real
distance
When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Returns
bool
Whether the two objects intersected. |
Intersects(const Ray& ray, Real& distance, Vector3& normal)
Determines if there is an intersection between sphere and a rat.
Declaration
public bool Intersects(const Ray& ray, Real& distance, Vector3& normal) const
Parameters
Ray
ray
The ray to test. |
Real
distance
When the method completes, contains the distance of the intersection, or 0 if there was no intersection. |
Vector3
normal
When the method completes, contains the intersection surface normal vector, or Vector3::Up if there was no intersection. |
Returns
bool
Whether the two objects intersected. |
Intersects(const Ray& ray, Vector3& point)
Determines if there is an intersection between sphere and a rat.
Declaration
public bool Intersects(const Ray& ray, Vector3& point) const
Parameters
Ray
ray
The ray to test. |
Vector3
point
When the method completes, contains the point of intersection, or Vector3::Zero if there was no intersection. |
Returns
bool
Whether the two objects intersected. |
Intersects(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)
Determines if there is an intersection between sphere and a triangle.
Declaration
public bool Intersects(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3) const
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
bool
Whether the two objects intersected. |
Merge(const BoundingSphere& value1, const BoundingSphere& value2, BoundingSphere& result)
Constructs a BoundingSphere that is the as large as the total combined area of the two specified spheres
Declaration
public static void Merge(const BoundingSphere& value1, const BoundingSphere& value2, BoundingSphere& result)
Parameters
Bounding The first sphere to merge. |
Bounding The second sphere to merge. |
Bounding When the method completes, contains the newly constructed bounding sphere. |
Merge(const BoundingSphere& value1, const Vector3& value2, BoundingSphere& result)
Constructs a BoundingSphere that is the as large as the total combined area of the specified sphere and the point.
Declaration
public static void Merge(const BoundingSphere& value1, const Vector3& value2, BoundingSphere& result)
Parameters
Bounding The sphere to merge. |
Vector3
value2
The point to merge. |
Bounding When the method completes, contains the newly constructed bounding sphere. |
NearEqual(const BoundingSphere& a, const BoundingSphere& b)
Declaration
public static bool NearEqual(const BoundingSphere& a, const BoundingSphere& b)
Parameters
Returns
bool
|
NearEqual(const BoundingSphere& a, const BoundingSphere& b, Real epsilon)
Declaration
public static bool NearEqual(const BoundingSphere& a, const BoundingSphere& b, Real epsilon)
Parameters
Bounding
|
Bounding
|
Real
epsilon
|
Returns
bool
|
operator!=(const BoundingSphere& other)
Declaration
public bool operator!=(const BoundingSphere& other) const
Parameters
Bounding
|
Returns
bool
|
operator==(const BoundingSphere& other)
Declaration
public bool operator==(const BoundingSphere& other) const
Parameters
Bounding
|
Returns
bool
|
ToString()
Transform(const BoundingSphere& sphere, const Matrix& matrix, BoundingSphere& result)
Transforms the bounding sphere using the specified matrix.
Declaration
public static void Transform(const BoundingSphere& sphere, const Matrix& matrix, BoundingSphere& result)
Parameters
Bounding The sphere. |
Matrix
matrix
The matrix. |
Bounding The result transformed sphere. |