## Frustum from matrix

In the last section, we created a Frustum primitive. We know that a frustum is made up of six planes: near, far, top, bottom, left, and right. In this section, we will explore how to extract those six planes from a view-projection matrix.

### Getting ready

We are going to add a new method to the `Camera`

class. This new method will create a frustum from the camera. In order for the `Camera`

class to know what a `Frustum`

is, we need to include `Geometry3D.h`

in `Camera.h`

.

### How to do it…

Follow these steps to build a frustum out of the camera's view and projection matrices:

Add the public

`GetFrustum`

function to the`Camera`

class in`Camera.h`

:class Camera { // Existing class implementation not listed // The GetFrusutm function is new Frustum GetFrustum(); };

Begin implementing the new

`GetFrustum`

function in`Camera.cpp`

by creating a view-projection matrix; store each column of this matrix as a vector:Frustum Camera::GetFrustum() { Frustum result;

Build out the view projection matrix...