Core Library
A simple library for handling 3D scenes
Camera Class Reference

The Camera class represents a perspective camera.

#include <camera.h>

Public Member Functions

void init (const Box &b)
 
QMatrix4x4 viewMatrix () const
 
QMatrix4x4 projectionMatrix () const
 
Point getObs () const
 
void updateClippingPlanes (const Box &)
 
void incrementDistance (float inc)
 
void setDistance (float value)
 
void incrementAngleX (float inc)
 
void setAngleX (float value)
 
void incrementAngleY (float inc)
 
void setAngleY (float value)
 
void setAngleZ (float value)
 
Vector eulerAngles () const
 
void pan (const Vector &offset)
 
float fov () const
 
void setFov (float fovy)
 
void setAspectRatio (float ar)
 
float aspectRatio () const
 
float znear () const
 
void setZnear (float z)
 
float zfar () const
 
void setZfar (float z)
 

Member Function Documentation

float Camera::aspectRatio ( ) const

Returns the camera aspect ratio.

Vector Camera::eulerAngles ( ) const

Returns v=(x,y,z) with the Euler angles of the camera. Rotation part of the viewing matrix is Rotz(-v.z)*Rotx(v.x)*Roty(-v.y)

float Camera::fov ( ) const

Returns the vertical field of view (degrees).

Point Camera::getObs ( ) const

Returns the camera (eye) position.

void Camera::incrementAngleX ( float  inc)

Rotates the camera by increasing the rotation angle around X axis (pitch).

void Camera::incrementAngleY ( float  inc)

Rotates the camera by increasing the rotation angle around Y axis (yaw).

void Camera::incrementDistance ( float  inc)

Moves the camera away (inc>0) or towards (inc<0) the current VRP.

void Camera::init ( const Box b)

Initializes the camera from a bounding box of the scene. The camera is placed outside the box, ensuring that the whole box fits within the viewing frustum.

void Camera::pan ( const Vector offset)

Offsets the camera position and VRP.

QMatrix4x4 Camera::projectionMatrix ( ) const

Returns a 4x4 matrix representing the projection transform of the camera.

void Camera::setAngleX ( float  value)

Rotates the camera by setting the rotation angle around X axis (pitch).

void Camera::setAngleY ( float  value)

Rotates the camera by setting the rotation angle around Y axis (yaw).

void Camera::setAngleZ ( float  value)

Rotates the camera by setting the rotation angle around Z axis (roll).

void Camera::setAspectRatio ( float  ar)

Sets the camera aspect ratio.

void Camera::setDistance ( float  value)

Sets the distance to the current VRP.

void Camera::setFov ( float  fovy)

Sets the vertical field of view (degrees).

void Camera::setZfar ( float  z)

Sets Z far

void Camera::setZnear ( float  z)

Sets Z near

void Camera::updateClippingPlanes ( const Box box)

Recomputes the near, far clipping planes according to the given bounding box.

QMatrix4x4 Camera::viewMatrix ( ) const

Returns a 4x4 matrix representing the viewing transform of the camera.

float Camera::zfar ( ) const

Returns zfar ( distance to the far clipping plane)

float Camera::znear ( ) const

Returns znear ( distance to the near clipping plane)