Search Results for

    Show / Hide Table of Contents

    Struct BoundingOrientedBox

    Bounding volume using an oriented bounding box.

    Namespace: Evergine.Mathematics
    Assembly: Evergine.Mathematics.dll
    Syntax
    public struct BoundingOrientedBox

    Constructors

    BoundingOrientedBox(Vector3, Vector3, Quaternion)

    Initializes a new instance of the BoundingOrientedBox struct.

    Declaration
    public BoundingOrientedBox(Vector3 center, Vector3 halfExtents, Quaternion orientation)
    Parameters
    Type Name Description
    Vector3 center

    The center.

    Vector3 halfExtents

    The half extents.

    Quaternion orientation

    The orientation.

    Fields

    Center

    Bounding box center.

    Declaration
    public Vector3 Center
    Field Value
    Type Description
    Vector3

    CornerCount

    Number of corners.

    Declaration
    public const int CornerCount = 8
    Field Value
    Type Description
    int

    HalfExtent

    Bounding box half-extents.

    Declaration
    public Vector3 HalfExtent
    Field Value
    Type Description
    Vector3

    Orientation

    Bounding box orientation.

    Declaration
    public Quaternion Orientation
    Field Value
    Type Description
    Quaternion

    Properties

    Maximum

    Gets the maximum.

    Declaration
    public Vector3 Maximum { get; }
    Property Value
    Type Description
    Vector3

    The maximum.

    Minimum

    Gets the minimum.

    Declaration
    public Vector3 Minimum { get; }
    Property Value
    Type Description
    Vector3

    The minimum.

    Methods

    Contains(ref BoundingBox)

    Determines if this box contains, intersects, or is disjoint from the given BoundingBox.

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

    The box.

    Returns
    Type Description
    ContainmentType

    The result.

    Contains(ref BoundingBox, ref BoundingOrientedBox)

    Determines if box A contains, intersects, or is disjoint from box B.

    Declaration
    public static ContainmentType Contains(ref BoundingBox boxA, ref BoundingOrientedBox oboxB)
    Parameters
    Type Name Description
    BoundingBox boxA

    The box A.

    BoundingOrientedBox oboxB

    The box B.

    Returns
    Type Description
    ContainmentType

    The result.

    Contains(BoundingFrustum)

    Determines whether this box contains, intersects, or is disjoint from the given frustum.

    Declaration
    public ContainmentType Contains(BoundingFrustum frustum)
    Parameters
    Type Name Description
    BoundingFrustum frustum

    The frustum.

    Returns
    Type Description
    ContainmentType

    The result.

    Contains(BoundingFrustum, ref BoundingOrientedBox)

    Determines whether the given frustum contains, intersects, or is disjoint from the given oriented box.

    Declaration
    public static ContainmentType Contains(BoundingFrustum frustum, ref BoundingOrientedBox obox)
    Parameters
    Type Name Description
    BoundingFrustum frustum

    The frustum.

    BoundingOrientedBox obox

    The oriented box.

    Returns
    Type Description
    ContainmentType

    The result.

    Contains(ref BoundingOrientedBox)

    Determines whether this box contains, intersects, or is disjoint from the given other box.

    Declaration
    public ContainmentType Contains(ref BoundingOrientedBox other)
    Parameters
    Type Name Description
    BoundingOrientedBox other

    The other box.

    Returns
    Type Description
    ContainmentType

    The result.

    Contains(ref BoundingSphere)

    Tests whether this box contains, intersects, or is disjoint from the given sphere.

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

    The sphere.

    Returns
    Type Description
    ContainmentType

    The result.

    Contains(ref BoundingSphere, ref BoundingOrientedBox)

    Tests whether a BoundingSphere contains, intersects, or is disjoint from a BoundingOrientedBox.

    Declaration
    public static ContainmentType Contains(ref BoundingSphere sphere, ref BoundingOrientedBox box)
    Parameters
    Type Name Description
    BoundingSphere sphere

    The sphere.

    BoundingOrientedBox box

    The box.

    Returns
    Type Description
    ContainmentType

    The result.

    Contains(ref Vector3)

    Returns true if this box contains the given point.

    Declaration
    public bool Contains(ref Vector3 point)
    Parameters
    Type Name Description
    Vector3 point

    The point.

    Returns
    Type Description
    bool

    The result.

    ContainsRelativeBox(ref Vector3, ref Vector3, ref Matrix4x4)

    Determines whether the box described by half-extents hA, axis-aligned and centered at the origin, contains the box described by half-extents hB, whose position and orientation are given by the transform matrix mB. The matrix is assumed to contain only rigid motion; if it contains scaling or perspective, the result of this method will be incorrect.

    Declaration
    public static ContainmentType ContainsRelativeBox(ref Vector3 hA, ref Vector3 hB, ref Matrix4x4 mB)
    Parameters
    Type Name Description
    Vector3 hA

    Half-extents of the first box.

    Vector3 hB

    Half-extents of the second box.

    Matrix4x4 mB

    Position and orientation of the second box relative to the first box.

    Returns
    Type Description
    ContainmentType

    ContainmentType enum indicating whether the boxes are disjoint, intersecting, or whether box A contains box B.

    ConvertToFrustum()

    Converts this BoundingOrientedBox to a BoundingFrustum describing the same volume. A BoundingFrustum is defined by the matrix that carries its volume to the box from (-1,-1,0) to (1,1,1), so we just need a matrix that carries our box there.

    Declaration
    public BoundingFrustum ConvertToFrustum()
    Returns
    Type Description
    BoundingFrustum

    The result.

    CreateFromBoundingBox(BoundingBox)

    Creates an oriented box from an axis-aligned box.

    Declaration
    public static BoundingOrientedBox CreateFromBoundingBox(BoundingBox box)
    Parameters
    Type Name Description
    BoundingBox box

    The box.

    Returns
    Type Description
    BoundingOrientedBox

    The result.

    Equals(BoundingOrientedBox)

    Compares with the specified other object for equality.

    Declaration
    public bool Equals(BoundingOrientedBox other)
    Parameters
    Type Name Description
    BoundingOrientedBox other

    The other object.

    Returns
    Type Description
    bool

    The result.

    Equals(object)

    Determines whether the specified object is equal to this instance.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with this instance.

    Returns
    Type Description
    bool

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

    Overrides
    ValueType.Equals(object)

    GetCorners()

    Returns the 8 corner positions of this bounding box.

    ZMax ZMin 0----1 4----5 | | | | | | | | 3----2 7----6.

    The ordering of indices is a little strange to match what BoundingBox.GetCorners() does.
    Declaration
    public Vector3[] GetCorners()
    Returns
    Type Description
    Vector3[]

    The result.

    GetCorners(Vector3[], int)

    Returns the 8 corner positions of this bounding box.

    ZMax ZMin 0----1 4----5 | | | | | | | | 3----2 7----6.

    The ordering of indices is a little strange to match what BoundingBox.GetCorners() does.
    Declaration
    public void GetCorners(Vector3[] corners, int startIndex)
    Parameters
    Type Name Description
    Vector3[] corners

    Array to fill with the eight corner positions.

    int startIndex

    Index within the corners array to start writing positions.

    GetHashCode()

    Returns a hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

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

    Overrides
    ValueType.GetHashCode()

    Intersects(ref BoundingBox)

    Determines if box A intersects box B.

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

    The box.

    Returns
    Type Description
    bool

    The result.

    Intersects(BoundingFrustum)

    Returns true if this box intersects with the given frustum.

    Declaration
    public bool Intersects(BoundingFrustum frustum)
    Parameters
    Type Name Description
    BoundingFrustum frustum

    The frustum.

    Returns
    Type Description
    bool

    The result.

    Intersects(ref BoundingFrustum, out bool)

    Returns true if this box intersects the given frustum.

    Declaration
    public void Intersects(ref BoundingFrustum frustum, out bool result)
    Parameters
    Type Name Description
    BoundingFrustum frustum

    The frustum.

    bool result

    If set to true [result].

    Intersects(ref BoundingOrientedBox)

    Returns true if this box intersects with the given other box.

    Declaration
    public bool Intersects(ref BoundingOrientedBox other)
    Parameters
    Type Name Description
    BoundingOrientedBox other

    The other box.

    Returns
    Type Description
    bool

    The result.

    Intersects(ref BoundingSphere)

    Tests whether this box intersects the given sphere.

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

    The sphere.

    Returns
    Type Description
    bool

    The result.

    Intersects(ref Plane)

    Classifies this bounding box as entirely in front of, in back of, or intersecting the given plane.

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

    The plane.

    Returns
    Type Description
    PlaneIntersectionType

    The result.

    Intersects(ref Ray)

    Determines whether the given ray intersects this box. If so, returns the parametric value of the point of first intersection; otherwise returns null.

    Declaration
    public float? Intersects(ref Ray ray)
    Parameters
    Type Name Description
    Ray ray

    The ray.

    Returns
    Type Description
    float?

    The result.

    ToString()

    Returns a string that represents this instance.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents this instance.

    Overrides
    ValueType.ToString()

    Transform(Matrix4x4)

    Transforms this bounding box.

    Declaration
    public void Transform(Matrix4x4 world)
    Parameters
    Type Name Description
    Matrix4x4 world

    The world matrix.

    Transform(Quaternion, Vector3)

    Transforms the given bounding box by a rotation around the origin followed by a translation.

    Declaration
    public BoundingOrientedBox Transform(Quaternion rotation, Vector3 translation)
    Parameters
    Type Name Description
    Quaternion rotation

    Rotation quaternion.

    Vector3 translation

    Translation vector.

    Returns
    Type Description
    BoundingOrientedBox

    A new bounding box, transformed relative to this one.

    Transform(Vector3, Quaternion, Vector3)

    Transforms the given bounding box by a uniform scale and rotation around the origin followed by a translation.

    Declaration
    public BoundingOrientedBox Transform(Vector3 scale, Quaternion rotation, Vector3 translation)
    Parameters
    Type Name Description
    Vector3 scale

    The scale.

    Quaternion rotation

    The rotation.

    Vector3 translation

    The translation.

    Returns
    Type Description
    BoundingOrientedBox

    A new bounding box, transformed relative to this one.

    Transform(float, Quaternion, Vector3)

    Transforms the given bounding box by a uniform scale and rotation around the origin followed by a translation.

    Declaration
    public BoundingOrientedBox Transform(float scale, Quaternion rotation, Vector3 translation)
    Parameters
    Type Name Description
    float scale

    The scale.

    Quaternion rotation

    The rotation.

    Vector3 translation

    The translation.

    Returns
    Type Description
    BoundingOrientedBox

    A new bounding box, transformed relative to this one.

    Operators

    operator ==(BoundingOrientedBox, BoundingOrientedBox)

    Implements the operator ==.

    Declaration
    public static bool operator ==(BoundingOrientedBox a, BoundingOrientedBox b)
    Parameters
    Type Name Description
    BoundingOrientedBox a

    The first operand.

    BoundingOrientedBox b

    The second operand.

    Returns
    Type Description
    bool

    The result of the operator.

    operator !=(BoundingOrientedBox, BoundingOrientedBox)

    Implements the operator !=.

    Declaration
    public static bool operator !=(BoundingOrientedBox a, BoundingOrientedBox b)
    Parameters
    Type Name Description
    BoundingOrientedBox a

    First bounding box.

    BoundingOrientedBox b

    Second bounding box.

    Returns
    Type Description
    bool

    The result of the operator.

    Extension Methods

    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In this article
    Back to top
    Generated by DocFX