Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

CCamera Class Reference

Camera class. More...

#include <CCamera.h>

List of all members.

Public Types

enum  CameraType { orthographic, perspective }

Public Member Functions

 CCamera ()
 CCamera (double rdEyePosX, double rdEyePosY, double rdEyePosZ, double rdRefPointX, double rdRefPointY, double rdRefPointZ, double rdViewUpX, double rdViewUpY, double rdViewUpZ, const CBoundingBox3D &cBBox=CBoundingBox3D(-1,-1,-1, 1, 1, 1), double rdVerAngle=30.0, int nVPHeight=480, double rdRatio=4.0/3.0, double rdNearPlane=0.0001, double rdFarPlane=10000.0, int nTimeStep=0)
 CCamera (CP3D cEyePos, CP3D cRefPoint, CV3D cViewUp, const CBoundingBox3D &cBBox=CBoundingBox3D(-1,-1,-1, 1, 1, 1), double rdVerAngle=30.0, int nVPHeight=480, double rdRatio=4.0/3.0, double rdNearPlane=0.0001, double rdFarPlane=10000.0, CameraType ctype=perspective, int nTimeStep=0)
virtual ~CCamera ()
void rotate (double rdAngle, CV3D cAxis, bool global=true)
void translate (CV3D vDiff)
void setRefPoint (const CP3D &cRefPoint)
const CP3DgetRefPoint () const
void setEyePos (const CP3D &cEyePos)
const CP3DgetEyePos () const
void setViewUp (const CV3D &cViewUp)
const CV3DgetViewUp () const
const CV3DgetViewDir () const
const CV3DgetViewRight () const
void setHVAngle (double rdHorAngle, double rdVerAngle)
void getHVAngle (double &rdHorAngle, double &rdVerAngle) const
void setClipPlanes (double rdNearPlane, double rdFarPlane)
void getClipPlanes (double &rdNearPlane, double &rdFarPlane) const
void setBoundingBox (const CBoundingBox3D &cBBox, bool fViewAll=true)
const CBoundingBox3DgetBoundingBox () const
void setCameraType (CameraType type)
CameraType getCameraType () const
void getVVolume (double array[6]) const
void setVPRes (int nVPWidth, int nVPHeight)
void getVPRes (int &nVPWidth, int &nVPHeight) const
void getVPParams (CP3D &origin, CV3D &xStep, CV3D &yStep, int nXSize, int nYSize) const
CMat4D getModelview () const
CMat4D getOrtho () const
CMat4D getFrustrum () const
CMat4D getProjection () const
CMat4D getVPTrans (int nXSize, int nYSize) const
void setRatio (double rdRatio)
double getRatio () const
void setFovy (double rdFovy)
double getFovy () const
void setVPHeight (int nVPHeight)
int getVPHeight () const
void setTimeStep (int nTimeStep)
int getTimeStep () const
void viewAll ()
void print ()

Private Attributes

CameraType m_CameraType
CBoundingBox3D m_cBBox
double m_rdVerAngle
double m_rdRatio
double m_rdNearPlane
double m_rdFarPlane
int m_nVPHeight
bool m_fValidViewDir
bool m_fValidViewRight
CP3D m_cEyePos
CP3D m_cRefPoint
CV3D m_cViewUp
CV3D m_cViewDir
CV3D m_cViewRight
int m_nTimeStep


Detailed Description

Camera class.

This class implements a camera including functionality to modify the camera (rotate, move, etc.).

Author:
Markus Janich


Member Enumeration Documentation

enum CCamera::CameraType
 

An enum type for the different types of projection.

Enumeration values:
orthographic  stands for a camera for parallel projection.
perspective  stands for a camera for perspective projection.


Constructor & Destructor Documentation

CCamera::CCamera   [inline]
 

Default Constructor Eye is at (0,0,-1), center is at (0,0,0), and up is (0,1,0) and it has a boundingbox with the edge (-1,-1,-1) and (1,1,1).

CCamera::CCamera double    rdEyePosX,
double    rdEyePosY,
double    rdEyePosZ,
double    rdRefPointX,
double    rdRefPointY,
double    rdRefPointZ,
double    rdViewUpX,
double    rdViewUpY,
double    rdViewUpZ,
const CBoundingBox3D   cBBox = CBoundingBox3D(-1, -1, -1, 1, 1, 1),
double    rdVerAngle = 30.0,
int    nVPHeight = 480,
double    rdRatio = 4.0/3.0,
double    rdNearPlane = 0.0001,
double    rdFarPlane = 10000.0,
int    nTimeStep = 0
[inline]
 

Constructor defining the view parameters.

Parameters:
cEyePos defines the eye position
cRefPoint defines the reference point (focuspoint)
cViewUp defines the view up vector
rdNearPlane distance between the eyepoint and the near clipping plane
cBBox the boundingbox of the whole scene
rdFarPlane distance between the eyepoint and the far clipping plane
rdVerAngle vertical open angle of the field of view
nVPHeight resolution (in pixels) of the viewplane in y-direction
rdRatio ratio between height and width, or hor. and vert. angle

CCamera::CCamera CP3D    cEyePos,
CP3D    cRefPoint,
CV3D    cViewUp,
const CBoundingBox3D   cBBox = CBoundingBox3D(-1, -1, -1, 1, 1, 1),
double    rdVerAngle = 30.0,
int    nVPHeight = 480,
double    rdRatio = 4.0/3.0,
double    rdNearPlane = 0.0001,
double    rdFarPlane = 10000.0,
CameraType    ctype = perspective,
int    nTimeStep = 0
[inline]
 

The same as above but different types of parameters.

virtual CCamera::~CCamera   [inline, virtual]
 

Default Destructor.


Member Function Documentation

const CBoundingBox3D& CCamera::getBoundingBox   const [inline]
 

Returns the boundingbox.

CameraType CCamera::getCameraType   const [inline]
 

Returns the type of the camera (perspective or orthographic).

void CCamera::getClipPlanes double &    rdNearPlane,
double &    rdFarPlane
const [inline]
 

Returns the distance between eye point and near/far clipplane.

const CP3D& CCamera::getEyePos   const [inline]
 

Get the current eye-point.

double CCamera::getFovy   const [inline]
 

This method returns the fovy angle.

CMat4D CCamera::getFrustrum   const
 

This method returns the glFrustrum() like matrix.

void CCamera::getHVAngle double &    rdHorAngle,
double &    rdVerAngle
const [inline]
 

Get horizontal and vertical angle of view of the camera.

NOTE:
This is a similar workaround in reversed direction as used in in the method 'setHVAngle()'.

CMat4D CCamera::getModelview   const
 

This method gets you the modelview matrix of the current setup just like gluLookAt().

CMat4D CCamera::getOrtho   const
 

This method returns the glOrtho() like matrix.

CMat4D CCamera::getProjection   const
 

This method gets you the projection matrix of the current setup just like glFrustrum()/glOrtho().

double CCamera::getRatio   const [inline]
 

This method returns the ratio.

const CP3D& CCamera::getRefPoint   const [inline]
 

Get the current reference-point.

int CCamera::getTimeStep   const [inline]
 

Get the TimeStep of the Camera for a 4DVolume

const CV3D & CCamera::getViewDir   const
 

Get the current normalized viewdirection-vector.

const CV3D & CCamera::getViewRight   const
 

Get the current normalized viewright-vector.

const CV3D& CCamera::getViewUp   const [inline]
 

Get the current viewup-vector.

int CCamera::getVPHeight   const [inline]
 

This method returns the vertical resolution of the viewplane.

void CCamera::getVPParams CP3D   origin,
CV3D   xStep,
CV3D   yStep,
int    nXSize,
int    nYSize
const
 

Returns all parameters of a viewplane which is orthogonal to the viewdirection and with a dimension of nXSize x nYSize.

Parameters:
origin returns the upper left point.
xStep returns the vector in x-direction from one pixel to another.
yStep returns the vector in y-direction from one pixel to another.
rdXSize the resolution of the viewplane in x-direction.
rdYSize the resolution of the viewplane in y-direction.

void CCamera::getVPRes int &    nVPWidth,
int &    nVPHeight
const [inline]
 

Returns the resolution of the viewplane in x- and y-direction.

CMat4D CCamera::getVPTrans int    nXSize,
int    nYSize
const
 

This method gets you the viewport transformation matrix of the current setup just like glViewport().

void CCamera::getVVolume double    array[6] const
 

Returns the viewing volume. The values are in right order:
x-coordinate of the upper left corner,
x-coordinate of the lower right corner,
y-coordinate of the upper left corner,
y-coordinate of the lower right corner, and
the distance between eye point and near/far clipplane.
Hey, what a surprise! These are the values especially needed for the OpenGL functions 'glFrustum' or 'glOrtho' to set the projection matrix.

void CCamera::print  
 

Prints the camera parameter to standard output.

void CCamera::rotate double    rdAngle,
CV3D    cAxis,
bool    global = true
 

Rotates the camera by an angle of 'rdAngle' degrees around an axis which goes through the reference point if 'global' is set to 'true'. If 'global' is 'false' the axis goes through the point of the eye position (for pitch, roll and yaw the camera). The direction of the axis is specified with 'cAxis'. This method changes the position of the camera if 'global' is 'true'.

void CCamera::setBoundingBox const CBoundingBox3D   cBBox,
bool    fViewAll = true
[inline]
 

Sets the dimension of the scene as a boundingbox in world coordinates.

void CCamera::setCameraType CameraType    type [inline]
 

Sets the type of the camera (perspective or orthographic).

void CCamera::setClipPlanes double    rdNearPlane,
double    rdFarPlane
[inline]
 

Set distance between eye point and near/far clipplane.

void CCamera::setEyePos const CP3D   cEyePos
 

Set a new eye-point.

void CCamera::setFovy double    rdFovy [inline]
 

This method sets the fovy (i.e. vertical opening) angle of the camera.

void CCamera::setHVAngle double    rdHorAngle,
double    rdVerAngle
[inline]
 

Deprecated:
This method is is just for downwards compatibility.

Don't use this method in new programs use 'setFovy()' and 'setRatio()' instead.

Set horizontal and vertical angle of view of the camera. The range for the angles goes from 0 to 180 degrees. Remember to adjust the resolution of the viewplane of the camera to the right ratio. If you don't do that you will get a distorted view volume by calling 'getVVolume()'.

NOTE:
What this function real does is setting the vertical opening angle and the ratio which it calculates out of the given angles.

void CCamera::setRatio double    rdRatio [inline]
 

This method sets the ratio between width and height (horizontal and vertical opening angle).

void CCamera::setRefPoint const CP3D   cRefPoint [inline]
 

Sets a new reference-point.

void CCamera::setTimeStep int    nTimeStep [inline]
 

Set the TimeStep in a 4DVolume

void CCamera::setViewUp const CV3D   cViewUp [inline]
 

Set a new viewup-vector.

void CCamera::setVPHeight int    nVPHeight [inline]
 

This method sets the vertical resolution of the viewplane.

void CCamera::setVPRes int    nVPWidth,
int    nVPHeight
[inline]
 

Deprecated:
This method is is just for downwards compatibility.

Don't use this method in new programs use 'setVPHeight()' and 'setRatio()' instead.

Set resolution of the viewplane in x- and y-direction. Remember to adjust the opening angles of the camera to the right ratio if don't want to get distorted view volume by calling 'getVVolume()'.

NOTE:
What this function real does is setting the vertical resolution of the viewplane and the ratio which it calculates out of the given x,y-resolution.

void CCamera::translate CV3D    vDiff
 

Move the camera relative to the current position by any distance in a 3-dimensional direction given by 'vDiff'.

NOTE: The view direction doesn't change!

void CCamera::viewAll  
 

Modifies the camera that the bounding box fits within the currently defined view frustum.


Member Data Documentation

CameraType CCamera::m_CameraType [private]
 

Reads a vector from the given stream.

CBoundingBox3D CCamera::m_cBBox [private]
 

CP3D CCamera::m_cEyePos [private]
 

CP3D CCamera::m_cRefPoint [private]
 

CV3D CCamera::m_cViewDir [mutable, private]
 

CV3D CCamera::m_cViewRight [mutable, private]
 

CV3D CCamera::m_cViewUp [private]
 

bool CCamera::m_fValidViewDir [mutable, private]
 

bool CCamera::m_fValidViewRight [mutable, private]
 

int CCamera::m_nTimeStep [private]
 

int CCamera::m_nVPHeight [private]
 

double CCamera::m_rdFarPlane [private]
 

double CCamera::m_rdNearPlane [private]
 

double CCamera::m_rdRatio [private]
 

double CCamera::m_rdVerAngle [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Mar 5 18:23:25 2003 for QGLViewer by doxygen1.3-rc3