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

The Camera class represents a perspective camera.

#include <camera.h>

List of all members.

Public Member Functions

void init (const Box &b)
QMatrix4x4 modelviewMatrix () const
QMatrix4x4 projectionMatrix () const
Point getObs () const
float znear () const
float zfar () const
void setAspectRatio (float ar)
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)

Member Function Documentation

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)

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 parameters from a bounding box of the scene. The camera is placed outside the box, ensuring that the whole box fits within the viewing frustum. Then sets the GL_MODELVIEW and GL_PROJECTION matrices.

QMatrix4x4 Camera::modelviewMatrix ( ) const

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

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::updateClippingPlanes ( const Box box)

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

float Camera::zfar ( ) const

Returns zfar ( distance to the far clipping plane)

float Camera::znear ( ) const

Returns znear ( distance to the near clipping plane)

 All Classes Functions