Search Results for

    Show / Hide Table of Contents

    Class BoundingBox

    Represents an axis-aligned bounding box in three dimensional space.

    Inheritance
    System.Object
    BoundingBox
    Implements
    System.IEquatable<BoundingBox>
    System.IFormattable
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public sealed class BoundingBox : ValueType, IEquatable<BoundingBox>, IFormattable

    Constructors

    BoundingBox(Vector3, Vector3)

    Initializes a new instance of the BoundingBox struct.

    Declaration
    public BoundingBox(Vector3 minimum, Vector3 maximum)
    Parameters
    Vector3 minimum

    The minimum vertex of the bounding box.

    Vector3 maximum

    The maximum vertex of the bounding box.

    Fields

    Empty

    A BoundingBox which represents an empty space.

    Declaration
    public static readonly BoundingBox Empty
    Field Value
    BoundingBox

    Maximum

    The maximum point of the box.

    Declaration
    public Vector3 Maximum
    Field Value
    Vector3

    Minimum

    The minimum point of the box.

    Declaration
    public Vector3 Minimum
    Field Value
    Vector3

    Zero

    A BoundingBox which is located in point (0, 0, 0) and has size equal (0, 0, 0).

    Declaration
    public static readonly BoundingBox Zero
    Field Value
    BoundingBox

    Properties

    Center

    Gets or sets the center point location.

    Declaration
    [NoSerialize]
    public Vector3 Center { get; set; }
    Property Value
    Vector3

    Default

    The default BoundingBox.

    Declaration
    public static BoundingBox Default { get; }
    Property Value
    BoundingBox

    Size

    Gets or sets the size.

    Declaration
    [NoSerialize]
    public Vector3 Size { get; set; }
    Property Value
    Vector3

    Methods

    Contains(BoundingBox)

    Determines whether the current objects contains a BoundingBox.

    Declaration
    public ContainmentType Contains(BoundingBox box)
    Parameters
    BoundingBox box

    The box to test.

    Returns
    ContainmentType

    The type of containment the two objects have.

    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(BoundingSphere)

    Determines whether the current objects contains a BoundingSphere.

    Declaration
    public ContainmentType Contains(BoundingSphere sphere)
    Parameters
    BoundingSphere sphere

    The sphere 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(Vector3)

    Determines whether the current objects contains a point.

    Declaration
    public ContainmentType Contains(Vector3 point)
    Parameters
    Vector3 point

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

    Equals(BoundingBox)

    Determines whether the specified Vector4 is equal to this instance.

    Declaration
    public bool Equals(BoundingBox value)
    Parameters
    BoundingBox value

    The Vector4 to compare with this instance.

    Returns
    System.Boolean

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

    Equals(ref BoundingBox)

    Determines whether the specified Vector4 is equal to this instance.

    Declaration
    public bool Equals(ref BoundingBox value)
    Parameters
    BoundingBox value

    The Vector4 to compare with this instance.

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

    Declaration
    public override bool Equals(object value)
    Parameters
    System.Object value

    The System.Object to compare with this instance.

    Returns
    System.Boolean

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

    FromPoints(Vector3[])

    Constructs a BoundingBox that fully contains the given points.

    Declaration
    public static BoundingBox FromPoints(Vector3[] points)
    Parameters
    Vector3[] points

    The points that will be contained by the box.

    Returns
    BoundingBox

    The newly constructed bounding box.

    Exceptions
    System.ArgumentNullException

    Thrown when points is null.

    FromPoints(Vector3[], out BoundingBox)

    Constructs a BoundingBox that fully contains the given points.

    Declaration
    public static void FromPoints(Vector3[] points, out BoundingBox result)
    Parameters
    Vector3[] points

    The points that will be contained by the box.

    BoundingBox result

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

    Exceptions
    System.ArgumentNullException

    Thrown when points is null.

    FromPoints(Span<Float3>, out BoundingBox)

    Constructs a BoundingBox that fully contains the given points.

    Declaration
    public static void FromPoints(Span<Float3> points, out BoundingBox result)
    Parameters
    System.Span<Float3> points

    The points that will be contained by the box.

    BoundingBox result

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

    Exceptions
    System.ArgumentNullException

    Thrown when points is null.

    FromSphere(BoundingSphere)

    Constructs a BoundingBox from a given sphere.

    Declaration
    public static BoundingBox FromSphere(BoundingSphere sphere)
    Parameters
    BoundingSphere sphere

    The sphere that will designate the extents of the box.

    Returns
    BoundingBox

    The newly constructed bounding box.

    FromSphere(ref BoundingSphere, out BoundingBox)

    Constructs a BoundingBox from a given sphere.

    Declaration
    public static void FromSphere(ref BoundingSphere sphere, out BoundingBox result)
    Parameters
    BoundingSphere sphere

    The sphere that will designate the extents of the box.

    BoundingBox result

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

    GetCorners()

    Retrieves the eight corners of the bounding box.

    Declaration
    public Vector3[] GetCorners()
    Returns
    Vector3[]

    An array of points representing the eight corners of the bounding box.

    GetCorners(Vector3[])

    Retrieves the eight corners of the bounding box.

    Declaration
    public void GetCorners(Vector3[] corners)
    Parameters
    Vector3[] corners

    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.

    MakeOffsetted(ref BoundingBox, ref Vector3)

    Creates the bounding box that is offseted by the given vector. Adds the offset value to minimum and maximum points.

    Declaration
    public static BoundingBox MakeOffsetted(ref BoundingBox box, ref Vector3 offset)
    Parameters
    BoundingBox box

    The box.

    Vector3 offset

    The bounds offset.

    Returns
    BoundingBox

    The offsetted bounds.

    MakeOffsetted(Vector3)

    Creates the bounding box that is offseted by the given vector. Adds the offset value to minimum and maximum points.

    Declaration
    public BoundingBox MakeOffsetted(Vector3 offset)
    Parameters
    Vector3 offset

    The bounds offset.

    Returns
    BoundingBox

    The offsetted bounds.

    MakeScaled(ref BoundingBox, Single)

    Creates the bounding box that is scaled by the given factor. Applies scale to the size of the bounds.

    Declaration
    public static BoundingBox MakeScaled(ref BoundingBox box, float scale)
    Parameters
    BoundingBox box

    The box.

    System.Single scale

    The bounds scale.

    Returns
    BoundingBox

    The scaled bounds.

    Merge(BoundingBox, BoundingBox)

    Constructs a BoundingBox that is as large as the total combined area of the two specified boxes.

    Declaration
    public static BoundingBox Merge(BoundingBox value1, BoundingBox value2)
    Parameters
    BoundingBox value1

    The first box to merge.

    BoundingBox value2

    The second box to merge.

    Returns
    BoundingBox

    The newly constructed bounding box.

    Merge(ref BoundingBox, ref BoundingBox, out BoundingBox)

    Constructs a BoundingBox that is as large as the total combined area of the two specified boxes.

    Declaration
    public static void Merge(ref BoundingBox value1, ref BoundingBox value2, out BoundingBox result)
    Parameters
    BoundingBox value1

    The first box to merge.

    BoundingBox value2

    The second box to merge.

    BoundingBox result

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

    Merge(ref BoundingBox, ref Vector3, out BoundingBox)

    Constructs a BoundingBox that is as large as the box and point.

    Declaration
    public static void Merge(ref BoundingBox value1, ref Vector3 value2, out BoundingBox result)
    Parameters
    BoundingBox value1

    The box to merge.

    Vector3 value2

    The point to merge.

    BoundingBox result

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

    Merge(Vector3)

    Constructs a BoundingBox that is as large as the box and point.

    Declaration
    public BoundingBox Merge(Vector3 value2)
    Parameters
    Vector3 value2

    The point to merge.

    Returns
    BoundingBox

    The newly constructed bounding box.

    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(BoundingBox, Matrix)

    Transforms bounding box using the given transformation matrix.

    Declaration
    public static BoundingBox Transform(BoundingBox box, Matrix transform)
    Parameters
    BoundingBox box

    The bounding box to transform.

    Matrix transform

    The transformation matrix.

    Returns
    BoundingBox

    The result of the transformation.

    Transform(BoundingBox, Transform)

    Transforms bounding box using the given transformation matrix.

    Declaration
    public static BoundingBox Transform(BoundingBox box, Transform transform)
    Parameters
    BoundingBox box

    The bounding box to transform.

    Transform transform

    The transformation matrix.

    Returns
    BoundingBox

    The result of the transformation.

    Transform(ref BoundingBox, ref Matrix, out BoundingBox)

    Transforms bounding box using the given transformation matrix.

    Declaration
    public static void Transform(ref BoundingBox box, ref Matrix transform, out BoundingBox result)
    Parameters
    BoundingBox box

    The bounding box to transform.

    Matrix transform

    The transformation matrix.

    BoundingBox result

    The result of the transformation.

    Transform(ref BoundingBox, ref Transform, out BoundingBox)

    Transforms bounding box using the given transformation.

    Declaration
    public static void Transform(ref BoundingBox box, ref Transform transform, out BoundingBox result)
    Parameters
    BoundingBox box

    The bounding box to transform.

    Transform transform

    The transformation.

    BoundingBox result

    The result of the transformation.

    Operators

    Equality(BoundingBox, BoundingBox)

    Tests for equality between two objects.

    Declaration
    public static bool operator ==(BoundingBox left, BoundingBox right)
    Parameters
    BoundingBox left

    The first value to compare.

    BoundingBox right

    The second value to compare.

    Returns
    System.Boolean

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

    Inequality(BoundingBox, BoundingBox)

    Tests for inequality between two objects.

    Declaration
    public static bool operator !=(BoundingBox left, BoundingBox right)
    Parameters
    BoundingBox left

    The first value to compare.

    BoundingBox right

    The second value to compare.

    Returns
    System.Boolean

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

    Multiply(BoundingBox, Matrix)

    Transforms bounding box using the given transformation matrix.

    Declaration
    public static BoundingBox operator *(BoundingBox box, Matrix transform)
    Parameters
    BoundingBox box

    The bounding box to transform.

    Matrix transform

    The transformation matrix.

    Returns
    BoundingBox

    The result of the transformation.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat