Camera

Types

uint32_t

Projection

Functions

Camera

Camera

bool

operator==

bool

operator!=

Detailed Description

class Camera

The Camera class is used to define a camera for a View. It specifies the position, target, up vector, field dimensions, and projection type.

The field of view of the camera is comprised of two numbers, field_width and field_height. These define the minimum area around the target that will be visible in the output window. The camera field, along with the distance between the camera position and the camera target, determine - in photographic terms - what kind of lens the camera is using. If the field is larger than the distance from the camera position to the target, then we have the equivalent of a wide-angle lens. If the distance between the camera position and target is much larger than the camera field, then we have the equivalent of a telephoto lens. Changing the size of the field (if the camera position and target remain fixed) is the same as zooming the lens. The ratio of the width to the height of the field is called the aspect ratio.

Public Types

enum Projection

An enumeration that indicates a camera’s projection type.

Values:

enumerator Invalid

This means the Camera Projection has not been set, and is effectively like having no Camera at all.

enumerator Perspective

Objects diminish in size the further they are from the camera, just as in a typical photograph.

enumerator Orthographic

Objects remain the same size, regardless of their distance from the camera.

enumerator Stretched

With a stretched projection, the scene stretches to fit the output window. The aspect ratio will not be preserved and the output may appear stretched or distorted.

Public Functions

inline Camera()
inline Camera(Projection projection, DPoint const &position, DPoint const &target, DVector const &up_vector, double field_width, double field_height)
inline bool operator==(Camera const &that) const
inline bool operator!=(Camera const &that) const

Public Members

Projection projection

Enum that specifies the projection type.

DPoint position

The location of the camera.

DPoint target

Sets the location where the camera is pointing.

DVector up_vector

Defines the vertical up vector of the camera.

double field_width

Sets the width of the camera field in world space units.

double field_height

Sets the height of the camera field in world space units.