# struct cogs::Frustum

## Overview

Definition of a 3-dimensional view frustum - a square-based 3D pyramid truncated by parallel planes. More…

    #include <Frustum.h>

    struct Frustum {
        // fields

        glm::vec3 position;
        glm::vec3 forward;
        glm::vec3 up;
        float near_distance;
        float far_distance;
        float horizontal_fov;
        float vertical_fov;

        // methods

        glm::vec3 Right() const;
        geom::Plane GetNearPlane() const;
        geom::Plane GetFarPlane() const;
        geom::Plane GetTopPlane() const;
        geom::Plane GetBottomPlane() const;
        geom::Plane GetRightPlane() const;
        geom::Plane GetLeftPlane() const;
        geom::Plane GetHorizontalPlane() const;
        geom::Plane GetVerticalPlane() const;
        std::array<glm::vec3, 4> GetSliceCorners(float slice_distance) const;
        std::array<glm::vec3, 4> GetNearCorners() const;
        std::array<glm::vec3, 4> GetFarCorners() const;
    };

## Detailed Documentation

Definition of a 3-dimensional view frustum - a square-based 3D pyramid truncated by parallel planes.

### Fields

    glm::vec3 position

Frustum position.

    glm::vec3 forward

Frustum forward vector. Points inside the Frustum from its position.

    glm::vec3 up

Frustum up vector.

    float near_distance

Distance of near plane from the Frustum ‘s position in the direction of its forward vector.

    float far_distance

Distance of far plane from the Frustum ‘s position in the direction of its forward vector.

    float horizontal_fov

Full horizontal field of view angle.

    float vertical_fov

Full vertical field of view angle.

### Methods

    glm::vec3 Right() const

Compute right vector from forward and up vectors.

    geom::Plane GetNearPlane() const

Compute near plane. The normal vector points inside the Frustum.

    geom::Plane GetFarPlane() const

Compute near plane. The normal vector points inside the Frustum.

    geom::Plane GetTopPlane() const

Compute top plane. The normal vector points inside the Frustum.

    geom::Plane GetBottomPlane() const

Compute bottom plane. The normal vector points inside the Frustum.

    geom::Plane GetRightPlane() const

Compute right plane. The normal vector points inside the Frustum.

    geom::Plane GetLeftPlane() const

Compute left plane. The normal vector points inside the Frustum.

    geom::Plane GetHorizontalPlane() const

Compute horizontal plane. The normal vector is the up vector.

    geom::Plane GetVerticalPlane() const

Compute vertical plane. The normal vector is the right vector.

    std::array<glm::vec3, 4> GetSliceCorners(float slice_distance) const

Compute corners of frustum slice quad, made in specified distance.

    std::array<glm::vec3, 4> GetNearCorners() const

Compute corners of frustum near plane quad.

    std::array<glm::vec3, 4> GetFarCorners() const

Compute corners of frustum far plane quad.