Skip to content
FutureBlitz

    Install

    Import std.math.geometry

    Frustum

    std.math.geometry

    struct

    Public Struct Frustum Implements Equatable, Printable

    What a camera sees: the six planes of its projection, each facing in.

    Examples

    
    Local camera = Mat4.Perspective(Deg(90), 1, 0.1, 100) *
                   Mat4.LookAt(Vec3(0, 0, 5), Vec3(0, 0, 0), Vec3(0, 1, 0))
    Local view = Frustum.FromMatrix(camera)
    Expect(view.Contains(Vec3(0, 0, 0)))
    Expect(!view.Contains(Vec3(0, 0, 10)))
    Expect(view.Intersects(Sphere(Vec3(0, 0, 0), 1)))

    std/math/geometry.fb, line 419

    • Public Field Left: Plane field #

      Its left plane, facing in.

    • Public Field Right: Plane field #

      Its right plane, facing in.

    • Public Field Bottom: Plane field #

      Its bottom plane, facing in.

    • Public Field Top: Plane field #

      Its top plane, facing in.

    • Public Field Near: Plane field #

      Its near plane, facing in.

    • Public Field Far: Plane field #

      Its far plane, facing in.

    • Public Static Method FromMatrix(m: Mat4): Frustum static method #

      The frustum of a projection times a view matrix, as Mat4.Perspective and LookAt make them, with depth from 0 to 1, in the space the view matrix takes from: the world's, for a camera.

    • Public Method Contains(point: Vec3): Bool method #

      Whether the point is inside, or on a plane.

    • Public Method Intersects(sphere: Sphere): Bool method #

      Whether the sphere is inside, or partly: False only when it's all behind a plane.

    • Public Method Intersects(box: AABB): Bool method #

      Whether the box is inside, or partly: False only when it's all behind a plane, so a box just past a corner of the frustum can be True, as culling allows.

    • Public Method ToString(): String method #

      Its six planes, left, right, bottom, top, near, and far, as "Frustum(Plane(...), ...)".

    Report an issue with this page or with FutureBlitz on GitHub.