Search Results for

    Show / Hide Table of Contents

    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 BoundingSphere struct.

    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
    BoundingSphere

    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
    BoundingBox box

    The box to test.

    Returns
    ContainmentType

    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
    BoundingSphere sphere

    The sphere to test.

    Returns
    ContainmentType

    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
    ContainmentType

    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
    ContainmentType

    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
    BoundingBox box

    The box that will designate the extents of the sphere.

    BoundingSphere result

    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.

    BoundingSphere result

    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.

    BoundingSphere result

    When the method completes, contains the newly constructed bounding sphere.

    GetBoundingBox()

    Gets the box which contains whole sphere.

    Declaration
    public BoundingBox GetBoundingBox() const
    Returns
    BoundingBox

    The box.

    GetBoundingBox(BoundingBox& result)

    Gets the box which contains whole sphere.

    Declaration
    public void GetBoundingBox(BoundingBox& result) const
    Parameters
    BoundingBox result

    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
    BoundingBox box

    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
    BoundingSphere sphere

    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
    PlaneIntersectionType

    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
    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.

    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
    BoundingSphere value1

    The sphere to merge.

    Vector3 value2

    The point to merge.

    BoundingSphere result

    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
    BoundingSphere a

    BoundingSphere b

    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
    BoundingSphere a

    BoundingSphere b

    Real epsilon

    Returns
    bool

    operator!=(const BoundingSphere& other)

    Declaration
    public bool operator!=(const BoundingSphere& other) const
    Parameters
    BoundingSphere other

    Returns
    bool

    operator==(const BoundingSphere& other)

    Declaration
    public bool operator==(const BoundingSphere& other) const
    Parameters
    BoundingSphere other

    Returns
    bool

    ToString()

    Declaration
    public String ToString() const
    Returns
    String

    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
    BoundingSphere sphere

    The sphere.

    Matrix matrix

    The matrix.

    BoundingSphere result

    The result transformed sphere.

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • BoundingSphere()
      • BoundingSphere(const Vector3& center, Real radius)
    • Fields
      • Center
      • Empty
      • Radius
    • Methods
      • Contains(const BoundingBox& box)
      • Contains(const BoundingSphere& sphere)
      • Contains(const Vector3& point)
      • Contains(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)
      • FromBox(const BoundingBox& box, BoundingSphere& result)
      • FromPoints(const Double3* points, int32 pointsCount, BoundingSphere& result)
      • FromPoints(const Float3* points, int32 pointsCount, BoundingSphere& result)
      • GetBoundingBox()
      • GetBoundingBox(BoundingBox& result)
      • Intersects(const BoundingBox& box)
      • Intersects(const BoundingSphere& sphere)
      • Intersects(const Plane& plane)
      • Intersects(const Ray& ray)
      • Intersects(const Ray& ray, Real& distance)
      • Intersects(const Ray& ray, Real& distance, Vector3& normal)
      • Intersects(const Ray& ray, Vector3& point)
      • Intersects(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3)
      • Merge(const BoundingSphere& value1, const BoundingSphere& value2, BoundingSphere& result)
      • Merge(const BoundingSphere& value1, const Vector3& value2, BoundingSphere& result)
      • NearEqual(const BoundingSphere& a, const BoundingSphere& b)
      • NearEqual(const BoundingSphere& a, const BoundingSphere& b, Real epsilon)
      • operator!=(const BoundingSphere& other)
      • operator==(const BoundingSphere& other)
      • ToString()
      • Transform(const BoundingSphere& sphere, const Matrix& matrix, BoundingSphere& result)
    Back to top Copyright © 2012-2024 Wojciech Figat