Camera Class Reference

#include <Camera.h>

Inheritance diagram for Camera:

GRAObject CameraGL List of all members.

Public Types

enum  PixelSample {
  PS_CENTROID, PS_UPPER_LEFT_CORNER, PS_UPPER_RIGHT_CORNER, PS_LOWER_RIGHT_CORNER,
  PS_LOWER_LEFT_CORNER, PS_RANDOM
}

Public Member Functions

 Camera (AutoPtr< Projection > *pAP)
 Camera ()
 Camera (const Camera &src)
virtual ~Camera ()
virtual void setTransform (const Matrix4 &trMat)
virtual void unsetTransform ()
virtual void rotateX (float angle)
virtual void rotateY (float angle)
virtual void rotateZ (float angle)
virtual void rotate (float angle, const Vector3 &axis)
virtual void translate (float x, float y, float z)
virtual bool isTransformed (Matrix4 *pTrMat) const
virtual void setProjection (AutoPtr< Projection > *pProj)
const ProjectiongetProjection () const
Vector2 getPixelSize (unsigned resX, unsigned resY) const
void getProjectionPlane (Vector3 &ll, Vector3 &ul, Vector3 &ur, Vector3 &lr) const
virtual Vector2 mapPixelToProjPlane (unsigned posX, unsigned posY, unsigned resX, unsigned resY, PixelSample sample) const
virtual Vector3 getProjectionDirection (const Vector2 &point)
virtual Vector3 getDirection ()
virtual Vector3 getZenith ()
virtual Vector2 project (const Vector3 &point) const
virtual bool projectAndClip (const Vector3 &point, Vector2 *res) const

Protected Attributes

Matrix4 * _pTrMat
AutoPtr< Projection > * _pAProjection
Projection_pProjection

Detailed Description

Definition at line 28 of file Camera.h.


Member Enumeration Documentation

enum PixelSample
 

Enumerator:
PS_CENTROID 
PS_UPPER_LEFT_CORNER 
PS_UPPER_RIGHT_CORNER 
PS_LOWER_RIGHT_CORNER 
PS_LOWER_LEFT_CORNER 
PS_RANDOM 

Definition at line 35 of file Camera.h.


Constructor & Destructor Documentation

Camera AutoPtr< Projection > *  pAP  ) 
 

Constuctor

Parameters:
pAP = projection of the camera

Definition at line 7 of file Camera.cc.

References Camera::_pAProjection, and Camera::_pProjection.

Camera  ) 
 

Constuctor with orthogonal projection with (-1, +1) frustum

Definition at line 16 of file Camera.cc.

References Camera::_pAProjection, and Camera::_pProjection.

Camera const Camera src  ) 
 

Copy contructor. Both the tranformation and projection matrices are cloned.

Parameters:
src = source camera

Definition at line 27 of file Camera.cc.

References Camera::_pAProjection, Camera::_pProjection, Camera::_pTrMat, and Projection::clone().

~Camera  )  [virtual]
 

Destructor

Definition at line 38 of file Camera.cc.

References Camera::_pAProjection, and Camera::_pTrMat.


Member Function Documentation

Vector3 getDirection  )  [virtual]
 

Returns:
camera's normalized direction in the world coord. system

Definition at line 186 of file Camera.cc.

References Camera::_pTrMat.

Vector2 getPixelSize unsigned  resX,
unsigned  resY
const
 

Return space occupied by single pixel of frame-buffer

Parameters:
resX X resolution of "CCD Chip" (frame-buffer) in pixels
resY Y resolution of "CCD Chip" (frame-buffer) in pixels
Returns:
space occupied by single pixel of the frame-buffer

Definition at line 114 of file Camera.cc.

References Camera::_pProjection, Projection::getBottomPlane(), Projection::getLeftPlane(), Projection::getRightPlane(), and Projection::getTopPlane().

Referenced by RTRender::_render().

const Projection& getProjection  )  const [inline]
 

Returns:
constant reference to actual projectin matrix

Definition at line 138 of file Camera.h.

Referenced by FrameBufferGL::setColor().

Vector3 getProjectionDirection const Vector2 &  point  )  [virtual]
 

Return projection direction of the point at projection plane

Parameters:
point point at projection plane, see mapPixelToProjPlane() and project()
Returns:
normalized vector in the world coordinate system going through the point

Definition at line 175 of file Camera.cc.

References Camera::_pProjection, Camera::_pTrMat, and Projection::getProjectionDirection().

Referenced by RTRender::_render_pixel_centroid(), RTRender::_render_pixel_corners(), RTRender::_render_pixel_randomly(), and RTRender::_render_pixel_stratified().

void getProjectionPlane Vector3 &  ll,
Vector3 &  ul,
Vector3 &  ur,
Vector3 &  lr
const
 

Returns corners of the projection area in the world coord. system

Parameters:
ll lower-left corner
ul upper-left corner
ur upper-right corner
lr lower-right corner

Definition at line 120 of file Camera.cc.

References Camera::_pProjection, Camera::_pTrMat, and Projection::getProjectionArea().

Referenced by RTRender::_render().

Vector3 getZenith  )  [virtual]
 

Returns:
normalized 'zenith' direction in the world coord. system

Definition at line 197 of file Camera.cc.

References Camera::_pTrMat.

bool isTransformed Matrix4 *  pTrMat  )  const [virtual]
 

Check whether the camera is transformed. If so then return tr. mat

Parameters:
pTrMat when non zero and transf. is present then it contains the copy of actual tr. matrix at output
Returns:
true if camera is transformed, false otherwise

Definition at line 95 of file Camera.cc.

References Camera::_pTrMat.

Vector2 mapPixelToProjPlane unsigned  posX,
unsigned  posY,
unsigned  resX,
unsigned  resY,
PixelSample  sample
const [virtual]
 

Compute position of pixel on the projection plane of camera

Parameters:
posX X pixel position, 0 = left
posY Y pixel position, 0 = bottom
resX X resolution of "CCD Chip" (frame-buffer) in pixels
resY Y resolution of "CCD Chip" (frame-buffer) in pixels
sample relative point inside the pixel that is sampled
Returns:
point in coord system of camera lieing at the projection plane; (0,0) is lower left corner

Definition at line 134 of file Camera.cc.

References Camera::_pProjection, Projection::getBottomPlane(), Projection::getLeftPlane(), Projection::getRightPlane(), Projection::getTopPlane(), Camera::PS_CENTROID, Camera::PS_LOWER_LEFT_CORNER, Camera::PS_LOWER_RIGHT_CORNER, Camera::PS_RANDOM, Camera::PS_UPPER_LEFT_CORNER, and Camera::PS_UPPER_RIGHT_CORNER.

Referenced by RTRender::_render_pixel_centroid(), RTRender::_render_pixel_corners(), and RTRender::_render_pixel_randomly().

Vector2 project const Vector3 &  point  )  const [virtual]
 

Project point is space onto the projection plane

Parameters:
point projecting point in space (in the world coord. system)
Returns:
position of the point at the projection plane (coord. system of the camera), [0,0] = lower-left corner of projection plane

Definition at line 208 of file Camera.cc.

References Camera::_pProjection, Camera::_pTrMat, Projection::getBottomPlane(), Projection::getLeftPlane(), and Projection::project().

Referenced by RTRender::_render_pixel_stratified().

bool projectAndClip const Vector3 &  point,
Vector2 *  res
const [virtual]
 

Project point is space onto the projection plane and then clip it

Parameters:
point projecting point in space (in the world coord. system)
res projected point ([0,0] = lower-left corner of projection plane)
Returns:
false if clipped, true otherwise

Definition at line 225 of file Camera.cc.

References Camera::_pProjection, Camera::_pTrMat, Projection::getBottomPlane(), Projection::getLeftPlane(), and Projection::projectAndClip().

void rotate float  angle,
const Vector3 &  axis
[virtual]
 

Rotates the camera around axis

Parameters:
angle = angle in radians
axis = axis to rotate around to

Reimplemented in CameraGL.

Definition at line 79 of file Camera.cc.

References Camera::_pTrMat.

Referenced by CameraGL::rotate().

void rotateX float  angle  )  [virtual]
 

Rotates the camera around X axis

Parameters:
angle = angle in radians

Reimplemented in CameraGL.

Definition at line 55 of file Camera.cc.

References Camera::_pTrMat.

Referenced by CameraGL::rotateX().

void rotateY float  angle  )  [virtual]
 

Rotates the camera around Y axis

Parameters:
angle = angle in radians

Reimplemented in CameraGL.

Definition at line 63 of file Camera.cc.

References Camera::_pTrMat.

Referenced by CameraGL::rotateY().

void rotateZ float  angle  )  [virtual]
 

Rotates the camera around Z axis

Parameters:
angle = angle in radians

Reimplemented in CameraGL.

Definition at line 71 of file Camera.cc.

References Camera::_pTrMat.

Referenced by CameraGL::rotateZ().

void setProjection AutoPtr< Projection > *  pProj  )  [virtual]
 

Set new projection

Parameters:
pProj new projection, NOT NULL

Reimplemented in CameraGL.

Definition at line 104 of file Camera.cc.

References Camera::_pAProjection, and Camera::_pProjection.

Referenced by CameraGL::setProjection().

void setTransform const Matrix4 &  trMat  )  [virtual]
 

Tranform _camera_

Parameters:
trMat = new transformation matrix

Reimplemented in CameraGL.

Definition at line 44 of file Camera.cc.

References Camera::_pTrMat.

Referenced by CameraGL::setTransform().

void translate float  x,
float  y,
float  z
[virtual]
 

Traslates the camera

Parameters:
x translation in x
y translation in y
z translation in z

Reimplemented in CameraGL.

Definition at line 87 of file Camera.cc.

References Camera::_pTrMat.

Referenced by CameraGL::translate().

void unsetTransform  )  [virtual]
 

Clear camera transformations

Reimplemented in CameraGL.

Definition at line 50 of file Camera.cc.

References Camera::_pTrMat.

Referenced by CameraGL::unsetTransform().


Member Data Documentation

AutoPtr<Projection>* _pAProjection [protected]
 

Definition at line 31 of file Camera.h.

Referenced by Camera::Camera(), Camera::setProjection(), and Camera::~Camera().

Projection* _pProjection [protected]
 

Definition at line 32 of file Camera.h.

Referenced by Camera::Camera(), CameraGL::CameraGL(), Camera::getPixelSize(), Camera::getProjectionDirection(), Camera::getProjectionPlane(), Camera::mapPixelToProjPlane(), Camera::project(), Camera::projectAndClip(), CameraGL::setProjection(), and Camera::setProjection().

Matrix4* _pTrMat [protected]
 

Definition at line 30 of file Camera.h.

Referenced by Camera::Camera(), CameraGL::CameraGL(), Camera::getDirection(), Camera::getProjectionDirection(), Camera::getProjectionPlane(), Camera::getZenith(), Camera::isTransformed(), Camera::project(), Camera::projectAndClip(), CameraGL::rotate(), Camera::rotate(), CameraGL::rotateX(), Camera::rotateX(), CameraGL::rotateY(), Camera::rotateY(), CameraGL::rotateZ(), Camera::rotateZ(), Camera::setTransform(), CameraGL::translate(), Camera::translate(), Camera::unsetTransform(), and Camera::~Camera().


The documentation for this class was generated from the following files:
Generated on Tue Nov 21 15:11:43 2006 for gra by  doxygen 1.4.6