Search Results for

    Show / Hide Table of Contents

    Class BoundingFrustum

    Defines a frustum which can be used in frustum culling, zoom to Extents (zoom to fit) operations, (matrix, frustum, camera) interchange, and many kind of intersection testing.

    Inheritance
    System.Object
    BoundingFrustum
    Implements
    System.IEquatable<BoundingFrustum>
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    public sealed class BoundingFrustum : ValueType, IEquatable<BoundingFrustum>

    Constructors

    BoundingFrustum(Matrix)

    Creates a new instance of BoundingFrustum.

    Declaration
    public BoundingFrustum(Matrix matrix)
    Parameters
    Matrix matrix

    Combined matrix that usually takes view × projection matrix.

    BoundingFrustum(ref Matrix)

    Creates a new instance of BoundingFrustum.

    Declaration
    public BoundingFrustum(ref Matrix matrix)
    Parameters
    Matrix matrix

    Combined matrix that usually takes view × projection matrix.

    Properties

    Bottom

    Gets the bottom plane of the BoundingFrustum.

    Declaration
    public Plane Bottom { get; }
    Property Value
    Plane

    Far

    Gets the far plane of the BoundingFrustum.

    Declaration
    public Plane Far { get; }
    Property Value
    Plane

    IsOrthographic

    Indicate whether the current BoundingFrustum is Orthographic.

    Declaration
    public bool IsOrthographic { get; }
    Property Value
    System.Boolean

    Left

    Gets the left plane of the BoundingFrustum.

    Declaration
    public Plane Left { get; }
    Property Value
    Plane

    Matrix

    Gets or sets the Matrix that describes this bounding frustum.

    Declaration
    public Matrix Matrix { get; set; }
    Property Value
    Matrix

    Near

    Gets the near plane of the BoundingFrustum.

    Declaration
    public Plane Near { get; }
    Property Value
    Plane

    Right

    Gets the right plane of the BoundingFrustum.

    Declaration
    public Plane Right { get; }
    Property Value
    Plane

    Top

    Gets the top plane of the BoundingFrustum.

    Declaration
    public Plane Top { get; }
    Property Value
    Plane

    Methods

    Contains(BoundingBox)

    Determines the intersection relationship between the frustum and a bounding box.

    Declaration
    public ContainmentType Contains(BoundingBox box)
    Parameters
    BoundingBox box

    The box.

    Returns
    ContainmentType

    Type of the containment

    Contains(ref BoundingBox)

    Determines the intersection relationship between the frustum and a bounding box.

    Declaration
    public ContainmentType Contains(ref BoundingBox box)
    Parameters
    BoundingBox box

    The box.

    Returns
    ContainmentType

    Type of the containment

    Contains(ref BoundingBox, out ContainmentType)

    Determines the intersection relationship between the frustum and a bounding box.

    Declaration
    public void Contains(ref BoundingBox box, out ContainmentType result)
    Parameters
    BoundingBox box

    The box.

    ContainmentType result

    Type of the containment.

    Contains(BoundingSphere)

    Determines the intersection relationship between the frustum and a bounding sphere.

    Declaration
    public ContainmentType Contains(BoundingSphere sphere)
    Parameters
    BoundingSphere sphere

    The sphere.

    Returns
    ContainmentType

    Type of the containment

    Contains(ref BoundingSphere)

    Determines the intersection relationship between the frustum and a bounding sphere.

    Declaration
    public ContainmentType Contains(ref BoundingSphere sphere)
    Parameters
    BoundingSphere sphere

    The sphere.

    Returns
    ContainmentType

    Type of the containment

    Contains(ref BoundingSphere, out ContainmentType)

    Determines the intersection relationship between the frustum and a bounding sphere.

    Declaration
    public void Contains(ref BoundingSphere sphere, out ContainmentType result)
    Parameters
    BoundingSphere sphere

    The sphere.

    ContainmentType result

    Type of the containment.

    Contains(Vector3)

    Checks whether a point lay inside, intersects or lay outside the frustum.

    Declaration
    public ContainmentType Contains(Vector3 point)
    Parameters
    Vector3 point

    The point.

    Returns
    ContainmentType

    Type of the containment

    Contains(ref Vector3)

    Checks whether a point lays inside, intersects or lays outside the frustum.

    Declaration
    public ContainmentType Contains(ref Vector3 point)
    Parameters
    Vector3 point

    The point.

    Returns
    ContainmentType

    Type of the containment

    Equals(BoundingFrustum)

    Determines whether the specified BoundingFrustum is equal to this instance.

    Declaration
    public bool Equals(BoundingFrustum other)
    Parameters
    BoundingFrustum other

    The BoundingFrustum to compare with this instance.

    Returns
    System.Boolean

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

    Equals(ref BoundingFrustum)

    Determines whether the specified BoundingFrustum is equal to this instance.

    Declaration
    public bool Equals(ref BoundingFrustum other)
    Parameters
    BoundingFrustum other

    The BoundingFrustum to compare with this instance.

    Returns
    System.Boolean

    true if the specified BoundingFrustum 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 obj)
    Parameters
    System.Object obj

    The System.Object to compare with this instance.

    Returns
    System.Boolean

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

    FromCamera(Vector3, Vector3, Vector3, Single, Single, Single, Single)

    Creates a new frustum based on a perspective camera parameters.

    Declaration
    public static BoundingFrustum FromCamera(Vector3 cameraPos, Vector3 lookDir, Vector3 upDir, float fov, float zNear, float zFar, float aspectRatio)
    Parameters
    Vector3 cameraPos

    The camera position.

    Vector3 lookDir

    The look direction.

    Vector3 upDir

    Up direction.

    System.Single fov

    The fov in radians.

    System.Single zNear

    The Z near plane.

    System.Single zFar

    The Z far plane.

    System.Single aspectRatio

    The aspect ratio.

    Returns
    BoundingFrustum

    The bounding frustum calculated from the perspective camera

    GetCorners()

    Returns the 8 corners of the frustum:

    [0] is Near1 (Near right down corner)

    [1] is Near2 (Near right top corner)

    [2] is Near3 (Near left top corner)

    [3] is Near4 (Near left down corner)

    [4] is Far1 (Far right down corner)

    [5] is Far2 (Far right top corner)

    [6] is Far3 (Far left top corner)

    [7] is Far4 (Far left down corner)

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

    The 8 corners of the frustum

    GetCorners(Vector3[])

    Populates the array with the 8 corners of the frustum:

    [0] is Near1 (Near right down corner)

    [1] is Near2 (Near right top corner)

    [2] is Near3 (Near left top corner)

    [3] is Near4 (Near left down corner)

    [4] is Far1 (Far right down corner)

    [5] is Far2 (Far right top corner)

    [6] is Far3 (Far left top corner)

    [7] is Far4 (Far left down corner)

    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.

    GetHeightAtDepth(Single)

    Get the height of the frustum at specified depth.

    Declaration
    public float GetHeightAtDepth(float depth)
    Parameters
    System.Single depth

    the depth at which to calculate frustum height.

    Returns
    System.Single

    Height of the frustum at the specified depth

    GetPlane(Int32)

    Returns one of the 6 planes related to this frustum.

    Declaration
    public Plane GetPlane(int index)
    Parameters
    System.Int32 index

    Plane index where 0 for Left, 1 for Right, 2 for Top, 3 for Bottom, 4 for Near, 5 for Far

    Returns
    Plane

    The frustum plane.

    GetWidthAtDepth(Single)

    Get the width of the frustum at specified depth.

    Declaration
    public float GetWidthAtDepth(float depth)
    Parameters
    System.Single depth

    the depth at which to calculate frustum width.

    Returns
    System.Single

    With of the frustum at the specified depth

    GetZoomToExtentsShiftDistance(ref BoundingBox)

    Get the distance which when added to camera position along the look-at direction will do the effect of zoom to extents (zoom to fit) operation, so all the passed points will fit in the current view. if the returned value is positive, the camera will move toward the look-at direction (ZoomIn). if the returned value is negative, the camera will move in the reverse direction of the look-at direction (ZoomOut).

    Declaration
    public float GetZoomToExtentsShiftDistance(ref BoundingBox boundingBox)
    Parameters
    BoundingBox boundingBox

    The bounding box.

    Returns
    System.Single

    The zoom to fit distance

    GetZoomToExtentsShiftDistance(Vector3[])

    Get the distance which when added to camera position along the look-at direction will do the effect of zoom to extents (zoom to fit) operation, so all the passed points will fit in the current view. if the returned value is positive, the camera will move toward the look-at direction (ZoomIn). if the returned value is negative, the camera will move in the reverse direction of the look-at direction (ZoomOut).

    Declaration
    public float GetZoomToExtentsShiftDistance(Vector3[] points)
    Parameters
    Vector3[] points

    The points.

    Returns
    System.Single

    The zoom to fit distance

    GetZoomToExtentsShiftVector(ref BoundingBox)

    Get the vector shift which when added to camera position will do the effect of zoom to extents (zoom to fit) operation, so all the passed points will fit in the current view.

    Declaration
    public Vector3 GetZoomToExtentsShiftVector(ref BoundingBox boundingBox)
    Parameters
    BoundingBox boundingBox

    The bounding box.

    Returns
    Vector3

    The zoom to fit vector

    GetZoomToExtentsShiftVector(Vector3[])

    Get the vector shift which when added to camera position will do the effect of zoom to extents (zoom to fit) operation, so all the passed points will fit in the current view.

    Declaration
    public Vector3 GetZoomToExtentsShiftVector(Vector3[] points)
    Parameters
    Vector3[] points

    The points.

    Returns
    Vector3

    The zoom to fit vector

    Intersects(ref BoundingBox)

    Checks whether the current BoundingFrustum intersects a BoundingBox.

    Declaration
    public bool Intersects(ref BoundingBox box)
    Parameters
    BoundingBox box

    The box.

    Returns
    System.Boolean

    true if the current BoundingFrustum intersects a BoundingSphere.

    Intersects(ref BoundingBox, out Boolean)

    Checks whether the current BoundingFrustum intersects a BoundingBox.

    Declaration
    public void Intersects(ref BoundingBox box, out bool result)
    Parameters
    BoundingBox box

    The box.

    System.Boolean result

    true if the current BoundingFrustum intersects a BoundingSphere.

    Intersects(ref BoundingSphere)

    Checks whether the current BoundingFrustum intersects a BoundingSphere.

    Declaration
    public bool Intersects(ref BoundingSphere sphere)
    Parameters
    BoundingSphere sphere

    The sphere.

    Returns
    System.Boolean

    Type of the containment

    Intersects(ref BoundingSphere, out Boolean)

    Checks whether the current BoundingFrustum intersects a BoundingSphere.

    Declaration
    public void Intersects(ref BoundingSphere sphere, out bool result)
    Parameters
    BoundingSphere sphere

    The sphere.

    System.Boolean result

    Set to true if the current BoundingFrustum intersects a BoundingSphere.

    Intersects(ref Plane)

    Checks whether the current BoundingFrustum intersects the specified Plane.

    Declaration
    public PlaneIntersectionType Intersects(ref Plane plane)
    Parameters
    Plane plane

    The plane.

    Returns
    PlaneIntersectionType

    Plane intersection type.

    Intersects(ref Plane, out PlaneIntersectionType)

    Checks whether the current BoundingFrustum intersects the specified Plane.

    Declaration
    public void Intersects(ref Plane plane, out PlaneIntersectionType result)
    Parameters
    Plane plane

    The plane.

    PlaneIntersectionType result

    Plane intersection type.

    Intersects(ref Ray)

    Checks whether the current BoundingFrustum intersects the specified Ray.

    Declaration
    public bool Intersects(ref Ray ray)
    Parameters
    Ray ray

    The ray.

    Returns
    System.Boolean

    true if the current BoundingFrustum intersects the specified Ray.

    Intersects(ref Ray, out Nullable<Single>, out Nullable<Single>)

    Checks whether the current BoundingFrustum intersects the specified Ray.

    Declaration
    public bool Intersects(ref Ray ray, out Nullable<float> inDistance, out Nullable<float> outDistance)
    Parameters
    Ray ray

    The Ray to check for intersection with.

    System.Nullable<System.Single> inDistance

    The distance at which the ray enters the frustum if there is an intersection and the ray starts outside the frustum.

    System.Nullable<System.Single> outDistance

    The distance at which the ray exits the frustum if there is an intersection.

    Returns
    System.Boolean

    true if the current BoundingFrustum intersects the specified Ray.

    Operators

    Equality(BoundingFrustum, BoundingFrustum)

    Implements the operator ==.

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

    The left.

    BoundingFrustum right

    The right.

    Returns
    System.Boolean

    The result of the operator.

    Inequality(BoundingFrustum, BoundingFrustum)

    Implements the operator !=.

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

    The left.

    BoundingFrustum right

    The right.

    Returns
    System.Boolean

    The result of the operator.

    Extension Methods

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