Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    BoundingSphere Struct

    Namespace: Stride.Core.Mathematics
    Assembly: Stride.Core.Mathematics.dll

    Represents a bounding sphere in three dimensional space.

    [DataContract]
    public struct BoundingSphere : IEquatable<BoundingSphere>, IFormattable, IIntersectableWithRay, IIntersectableWithPlane
    Name Description
    Constructors
    BoundingSphere(Vector3, Single)

    Initializes a new instance of the BoundingSphere struct.

    Fields
    Center

    The center of the sphere in three dimensional space.

    Empty

    An empty bounding sphere (Center = 0 and Radius = 0).

    Radius

    The radius of the sphere.

    Methods
    Contains(ref BoundingBox)

    Determines whether the current objects contains a BoundingBox.

    Contains(ref BoundingSphere)

    Determines whether the current objects contains a BoundingSphere.

    Contains(ref Vector3)

    Determines whether the current objects contains a point.

    Contains(ref Vector3, ref Vector3, ref Vector3)

    Determines whether the current objects contains a triangle.

    Equals(BoundingSphere)

    Determines whether the specified Vector4 is equal to this instance.

    Equals(Object)

    Determines whether the specified System.Object is equal to this instance.

    FromBox(BoundingBox)

    Constructs a BoundingSphere from a given box.

    FromBox(ref BoundingBox, out BoundingSphere)

    Constructs a BoundingSphere from a given box.

    FromPoints(Vector3[])

    Constructs a BoundingSphere that fully contains the given points.

    FromPoints(Vector3[], out BoundingSphere)

    Constructs a BoundingSphere that fully contains the given points.

    FromPoints(IntPtr, Int32, Int32, Int32, out BoundingSphere)

    Constructs a BoundingSphere that fully contains the given unmanaged points.

    GetHashCode()

    Returns a hash code for this instance.

    Intersects(ref BoundingBox)

    Determines if there is an intersection between the current object and a BoundingBox.

    Intersects(ref BoundingSphere)

    Determines if there is an intersection between the current object and a BoundingSphere.

    Intersects(ref Plane)

    Determines if there is an intersection between the current object and a Plane.

    Intersects(ref Ray)

    Determines if there is an intersection between the current object and a Ray.

    Intersects(ref Ray, out Vector3)

    Determines if there is an intersection between the current object and a Ray.

    Intersects(ref Ray, out Single)

    Determines if there is an intersection between the current object and a Ray.

    Intersects(ref Vector3, ref Vector3, ref Vector3)

    Determines if there is an intersection between the current object and a triangle.

    Merge(BoundingSphere, BoundingSphere)

    Constructs a BoundingSphere that is the as large as the total combined area of the two specified spheres.

    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.

    ToString()

    Returns a System.String that represents this instance.

    ToString(IFormatProvider)

    Returns a System.String that represents this instance.

    ToString(String)

    Returns a System.String that represents this instance.

    ToString(String, IFormatProvider)

    Returns a System.String that represents this instance.

    Transform(ref BoundingSphere, ref Matrix, out BoundingSphere)

    Transforms a bounding bounding sphere, yielding the bounding sphere of all points contained by the original one, transformed by the specified transform.

    Operators
    Equality(BoundingSphere, BoundingSphere)

    Tests for equality between two objects.

    Inequality(BoundingSphere, BoundingSphere)

    Tests for inequality between two objects.

    | Improve this Doc View Source

    Constructors


    BoundingSphere(Vector3, Single)

    Initializes a new instance of the BoundingSphere struct.

    public BoundingSphere(Vector3 center, float radius)
    Parameters
    Type Name Description
    Vector3 center

    The center of the sphere in three dimensional space.

    System.Single radius

    The radius of the sphere.

    | Improve this Doc View Source

    Fields


    Center

    The center of the sphere in three dimensional space.

    public Vector3 Center
    Field Value
    Type Description
    Vector3

    Empty

    An empty bounding sphere (Center = 0 and Radius = 0).

    public static readonly BoundingSphere Empty
    Field Value
    Type Description
    BoundingSphere

    Radius

    The radius of the sphere.

    public float Radius
    Field Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Methods


    Contains(ref BoundingBox)

    Determines whether the current objects contains a BoundingBox.

    public ContainmentType Contains(ref BoundingBox box)
    Parameters
    Type Name Description
    BoundingBox box

    The box to test.

    Returns
    Type Description
    ContainmentType

    The type of containment the two objects have.


    Contains(ref BoundingSphere)

    Determines whether the current objects contains a BoundingSphere.

    public ContainmentType Contains(ref BoundingSphere sphere)
    Parameters
    Type Name Description
    BoundingSphere sphere

    The sphere to test.

    Returns
    Type Description
    ContainmentType

    The type of containment the two objects have.


    Contains(ref Vector3)

    Determines whether the current objects contains a point.

    public ContainmentType Contains(ref Vector3 point)
    Parameters
    Type Name Description
    Vector3 point

    The point to test.

    Returns
    Type Description
    ContainmentType

    The type of containment the two objects have.


    Contains(ref Vector3, ref Vector3, ref Vector3)

    Determines whether the current objects contains a triangle.

    public ContainmentType Contains(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
    Parameters
    Type Name Description
    Vector3 vertex1

    The first vertex of the triangle to test.

    Vector3 vertex2

    The second vertex of the triagnle to test.

    Vector3 vertex3

    The third vertex of the triangle to test.

    Returns
    Type Description
    ContainmentType

    The type of containment the two objects have.


    Equals(BoundingSphere)

    Determines whether the specified Vector4 is equal to this instance.

    public bool Equals(BoundingSphere value)
    Parameters
    Type Name Description
    BoundingSphere value

    The Vector4 to compare with this instance.

    Returns
    Type Description
    System.Boolean

    true if the specified Vector4 is equal to this instance; otherwise, false.


    Equals(Object)

    Determines whether the specified System.Object is equal to this instance.

    public override bool Equals(object value)
    Parameters
    Type Name Description
    System.Object value

    The System.Object to compare with this instance.

    Returns
    Type Description
    System.Boolean

    true if the specified System.Object is equal to this instance; otherwise, false.

    Overrides
    System.ValueType.Equals(System.Object)

    FromBox(BoundingBox)

    Constructs a BoundingSphere from a given box.

    public static BoundingSphere FromBox(BoundingBox box)
    Parameters
    Type Name Description
    BoundingBox box

    The box that will designate the extents of the sphere.

    Returns
    Type Description
    BoundingSphere

    The newly constructed bounding sphere.


    FromBox(ref BoundingBox, out BoundingSphere)

    Constructs a BoundingSphere from a given box.

    public static void FromBox(ref BoundingBox box, out BoundingSphere result)
    Parameters
    Type Name Description
    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.

    public static BoundingSphere FromPoints(Vector3[] points)
    Parameters
    Type Name Description
    Vector3[] points

    The points that will be contained by the sphere.

    Returns
    Type Description
    BoundingSphere

    The newly constructed bounding sphere.


    FromPoints(Vector3[], out BoundingSphere)

    Constructs a BoundingSphere that fully contains the given points.

    public static void FromPoints(Vector3[] points, out BoundingSphere result)
    Parameters
    Type Name Description
    Vector3[] points

    The points that will be contained by the sphere.

    BoundingSphere result

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


    FromPoints(IntPtr, Int32, Int32, Int32, out BoundingSphere)

    Constructs a BoundingSphere that fully contains the given unmanaged points.

    public static void FromPoints(IntPtr vertexBufferPtr, int vertexPositionOffsetInBytes, int vertexCount, int vertexStride, out BoundingSphere result)
    Parameters
    Type Name Description
    System.IntPtr vertexBufferPtr

    A pointer to of vertices containing points.

    System.Int32 vertexPositionOffsetInBytes

    The point offset in bytes starting from the vertex structure.

    System.Int32 vertexCount

    The verterx vertexCount.

    System.Int32 vertexStride

    The vertex stride (size of vertex).

    BoundingSphere result

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


    GetHashCode()

    Returns a hash code for this instance.

    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

    Overrides
    System.ValueType.GetHashCode()

    Intersects(ref BoundingBox)

    Determines if there is an intersection between the current object and a BoundingBox.

    public bool Intersects(ref BoundingBox box)
    Parameters
    Type Name Description
    BoundingBox box

    The box to test.

    Returns
    Type Description
    System.Boolean

    Whether the two objects intersected.


    Intersects(ref BoundingSphere)

    Determines if there is an intersection between the current object and a BoundingSphere.

    public bool Intersects(ref BoundingSphere sphere)
    Parameters
    Type Name Description
    BoundingSphere sphere

    The sphere to test.

    Returns
    Type Description
    System.Boolean

    Whether the two objects intersected.


    Intersects(ref Plane)

    Determines if there is an intersection between the current object and a Plane.

    public PlaneIntersectionType Intersects(ref Plane plane)
    Parameters
    Type Name Description
    Plane plane

    The plane to test.

    Returns
    Type Description
    PlaneIntersectionType

    Whether the two objects intersected.


    Intersects(ref Ray)

    Determines if there is an intersection between the current object and a Ray.

    public bool Intersects(ref Ray ray)
    Parameters
    Type Name Description
    Ray ray

    The ray to test.

    Returns
    Type Description
    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.

    public bool Intersects(ref Ray ray, out Vector3 point)
    Parameters
    Type Name Description
    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
    Type Description
    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.

    public bool Intersects(ref Ray ray, out float distance)
    Parameters
    Type Name Description
    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
    Type Description
    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.

    public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)
    Parameters
    Type Name Description
    Vector3 vertex1

    The first vertex of the triangle to test.

    Vector3 vertex2

    The second vertex of the triagnle to test.

    Vector3 vertex3

    The third vertex of the triangle to test.

    Returns
    Type Description
    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.

    public static BoundingSphere Merge(BoundingSphere value1, BoundingSphere value2)
    Parameters
    Type Name Description
    BoundingSphere value1

    The first sphere to merge.

    BoundingSphere value2

    The second sphere to merge.

    Returns
    Type Description
    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.

    public static void Merge(ref BoundingSphere value1, ref BoundingSphere value2, out BoundingSphere result)
    Parameters
    Type Name Description
    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.

    public override string ToString()
    Returns
    Type Description
    System.String

    A System.String that represents this instance.

    Overrides
    System.ValueType.ToString()

    ToString(IFormatProvider)

    Returns a System.String that represents this instance.

    public string ToString(IFormatProvider formatProvider)
    Parameters
    Type Name Description
    System.IFormatProvider formatProvider

    The format provider.

    Returns
    Type Description
    System.String

    A System.String that represents this instance.


    ToString(String)

    Returns a System.String that represents this instance.

    public string ToString(string format)
    Parameters
    Type Name Description
    System.String format

    The format.

    Returns
    Type Description
    System.String

    A System.String that represents this instance.


    ToString(String, IFormatProvider)

    Returns a System.String that represents this instance.

    public string ToString(string format, IFormatProvider formatProvider)
    Parameters
    Type Name Description
    System.String format

    The format.

    System.IFormatProvider formatProvider

    The format provider.

    Returns
    Type Description
    System.String

    A System.String that represents this instance.


    Transform(ref BoundingSphere, ref Matrix, out BoundingSphere)

    Transforms a bounding bounding sphere, yielding the bounding sphere of all points contained by the original one, transformed by the specified transform.

    public static void Transform(ref BoundingSphere value, ref Matrix transform, out BoundingSphere result)
    Parameters
    Type Name Description
    BoundingSphere value

    The original bounding sphere.

    Matrix transform

    The transform to apply to the bounding sphere.

    BoundingSphere result

    The transformed bounding sphere.

    | Improve this Doc View Source

    Operators


    Equality(BoundingSphere, BoundingSphere)

    Tests for equality between two objects.

    public static bool operator ==(BoundingSphere left, BoundingSphere right)
    Parameters
    Type Name Description
    BoundingSphere left

    The first value to compare.

    BoundingSphere right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has the same value as right; otherwise, false.


    Inequality(BoundingSphere, BoundingSphere)

    Tests for inequality between two objects.

    public static bool operator !=(BoundingSphere left, BoundingSphere right)
    Parameters
    Type Name Description
    BoundingSphere left

    The first value to compare.

    BoundingSphere right

    The second value to compare.

    Returns
    Type Description
    System.Boolean

    true if left has a different value than right; otherwise, false.


    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation