In file graphics3D/Camera3D.h:

class Camera3D : public ListElement<Camera3D>, public Activable, public Camera, Rotation3D, Scene3D, Data3D, Camera3D>

Generic camera object for 3D Objects

Inheritance:


Public Methods

static LONGINT getRenderDuration ()
returns the time needed to render the scene by the camera
static LONGINT getClickDuration ()
returns the difference between the time when the mouse was clicked and the mouse button was released
BUTTON_STATE getButtonState (WHICH_BUTTON w)
get state of mouse buttons

Protected Fields

Vec3 eye
camera position
Vec3 refCenter
perspective center
double dl
the field depth ratio multiplied by the radius
double expansionX
the expansion in the X direction computed as dl*tan(fieldOfView)/(width/2)
double expansionY
the expansion in the X direction computed as dl*tan(fieldOfView)/(height/2)
Vec3 mouse
3D mouse position corresponding to the 3D point defining the 3D line defined when a mouse button is clicked, the other extremity of the line being the center of the camera

Protected Methods

Vec3 computeEye (void)
The routines that computes the 3D lines associated with a given pixel
Vec3 getRefCenter (void) const
returns the reference center of the camera
void setRefCenter (Vec3 rc)
set the reference center of the camera
Matrix4x4 getMatTransform (void) const
returns the 4x4 matrix in homogeneous coordinate corresponding to the actual rotation, translation and scale performed
void setMatTransform (Matrix4x4 mat)
set the 4x4 Viewing matrix in homogeneous coordinate
void setParameters (void)
computes expansionX, expansionY and dl variables given the new height and width of the camera
Vec3 getMousePosition (const Vec2 &pixel)
returns the mouse position vector given the a pixel position
void getEyeDirectionVector (const Vec2 &pixel, Vec3&eye, Vec3&dir)
returns the 3D line associated with a pixel of the camera
double getFieldOfView () const
returns the field of view of the camera
void setFieldOfView (const double f)
set the field of view of the camera
virtual void pickObject (const Vec2 &pixel)
Given a pixel find the closest Data3D object and call setSelectedObject() on the selected object
void rotate (const Vec3& axis, double angle)
compose rotation matrix of camera with the rotation defined by (axis, angle)
virtual void rotateObject (const Rotation3D &r)
rotates selected object
virtual void rotateCamera (Rotation3D& rot)
rotates camera
virtual void translateCamera (Vec3 &t)
translates camera center
virtual void scaleCamera (double s)
scales camera
void doFocus (void)
focus whatever autofocus says
void focusOnRegion (Vec3 &c, double _radius)
focus the camera on a given region defined as a sphere
virtual void init (void)
function called at the creation of the Camera3D : initialized as empty
virtual void defineLights (void)
function that defines the lights applied with the camera : initialized as empty
virtual void useLights (void) const
function that use given lights : initialized as empty
virtual void applyTransformation (void)
applies matTransform to the current transformation matrix : initialized as empty
virtual void setViewingParameters (bool reset=true)
updates the internal camera parameters after the camera size has changed : initialized as empty
virtual void bindMouseMotion (bool on)
set the action to perform each time the mouse is moved
virtual void startComputation ()
The action performed when the deformation loop of the scene is activated
virtual void stopComputation ()
The action performed when the deformation loop of the scene is de-activated
Vec3 mapToScreen (const Vec3& t)
transforms a translation vector from screen coordinate to World coordinates
virtual void startAutoMove (AUTO_MOVE_MODE amm)
activates a camera for auto-move
virtual void stopAutoMove (void)
stops camera auto-move
virtual void activation (void)
Activable activation routine callback
virtual void redraw (void)
redraw scene
virtual Vec3 getTrackballVector (int x, int y) const
get trackball location function of mouse pointer location
virtual Rotation3D getTrackballRotation (const Vec3&a, const Vec3&b)
get trackball rotation from mouse pointer move and store results in autoRotation matrix
virtual double getTrackballScale (const Vec3&a, const Vec3&b)
get trackball scale from mouse pointer move and store results in autoRotation matrix
virtual Vec3 getTrackballTranslation (const Vec3& a, const Vec3& b)
get trackball translation from mouse pointer move
virtual Vec3 getTrackballZTranslation (const double a)
get trackball translation from mouse pointer movein the Z direction
void mapworld2 (const Vec2 &pixel, double *wx, double *wy)
transforms a pixel position in standard camera coordinates

Protected

constructor
Camera3D (Camera3D *c)
builds a camera3D by calling the Camera() constructor
Camera3D (Scene3D *scn = 0)
Creates a new camera
destructor
virtual ~Camera3D ()
empty

Private Methods

void initCamera (void)
adds the camera in the corresponding scene and sets all protected parameters to their initial values

Documentation

Generic camera object for 3D Objects
Vec3 eye
camera position

Vec3 refCenter
perspective center

double dl
the field depth ratio multiplied by the radius

double expansionX
the expansion in the X direction computed as dl*tan(fieldOfView)/(width/2)

double expansionY
the expansion in the X direction computed as dl*tan(fieldOfView)/(height/2)

Vec3 mouse
3D mouse position corresponding to the 3D point defining the 3D line defined when a mouse button is clicked, the other extremity of the line being the center of the camera

void initCamera(void)
adds the camera in the corresponding scene and sets all protected parameters to their initial values

constructor

Camera3D(Camera3D *c)
builds a camera3D by calling the Camera() constructor
Parameters:
c - unused parameter

Camera3D(Scene3D *scn = 0)
Creates a new camera. The camera visualize given scene. If scn is 0
Parameters:
scn - the scene where the camera should look at. If scn is 0 the camera visualize the first scene in global scene list (if any) or a new scene is created

destructor

virtual ~Camera3D()
empty

Vec3 computeEye(void)
The routines that computes the 3D lines associated with a given pixel

Vec3 getRefCenter(void) const
returns the reference center of the camera

void setRefCenter(Vec3 rc)
set the reference center of the camera

Matrix4x4 getMatTransform(void) const
returns the 4x4 matrix in homogeneous coordinate corresponding to the actual rotation, translation and scale performed. It corresponds to the Viewing matrix in OpenGL

void setMatTransform(Matrix4x4 mat)
set the 4x4 Viewing matrix in homogeneous coordinate

void setParameters(void)
computes expansionX, expansionY and dl variables given the new height and width of the camera

Vec3 getMousePosition(const Vec2 &pixel)
returns the mouse position vector given the a pixel position. The mouse position is a 3D point defining the 3D line defined by a camera pixel, the other extremity of the line being the center of the camera
Returns:
the mouse position in world coordinates
Parameters:
pixel - the pixel position

void getEyeDirectionVector(const Vec2 &pixel, Vec3&eye, Vec3&dir)
returns the 3D line associated with a pixel of the camera
Parameters:
pixel - the pixel position
eye - the coordinate of the camera center
dir - the unit vector designed the direction of the 3D line pointing from the camera center

double getFieldOfView() const
returns the field of view of the camera

void setFieldOfView(const double f)
set the field of view of the camera

virtual void pickObject(const Vec2 &pixel)
Given a pixel find the closest Data3D object and call setSelectedObject() on the selected object
Parameters:
pixel - the pixel coordinates

void rotate(const Vec3& axis, double angle)
compose rotation matrix of camera with the rotation defined by (axis, angle)
Parameters:
axis - the unit vector describing the rotation axis
angle - the angle of rotation in radian

virtual void rotateObject(const Rotation3D &r)
rotates selected object
Parameters:
r - rotation matrix

virtual void rotateCamera(Rotation3D& rot)
rotates camera
Parameters:
rot - rotation matrix (unsused)

virtual void translateCamera(Vec3 &t)
translates camera center
Parameters:
t - translation vector

virtual void scaleCamera(double s)
scales camera
Parameters:
s - scale

void doFocus(void)
focus whatever autofocus says

void focusOnRegion(Vec3 &c, double _radius)
focus the camera on a given region defined as a sphere
Parameters:
c - the region center
_radius - the region radius

virtual void init(void)
function called at the creation of the Camera3D : initialized as empty

virtual void defineLights(void)
function that defines the lights applied with the camera : initialized as empty

virtual void useLights(void) const
function that use given lights : initialized as empty

virtual void applyTransformation(void)
applies matTransform to the current transformation matrix : initialized as empty

virtual void setViewingParameters(bool reset=true)
updates the internal camera parameters after the camera size has changed : initialized as empty
Parameters:
reset - wether tp init the transformation matrix to identity

virtual void bindMouseMotion(bool on)
set the action to perform each time the mouse is moved
Parameters:
on - if true then a specific action is performed each time the mouse is moved. If false then unbind the action

virtual void startComputation()
The action performed when the deformation loop of the scene is activated

virtual void stopComputation()
The action performed when the deformation loop of the scene is de-activated

Vec3 mapToScreen(const Vec3& t)
transforms a translation vector from screen coordinate to World coordinates
Parameters:
t - the translation vector in screen coordinates

virtual void startAutoMove(AUTO_MOVE_MODE amm)
activates a camera for auto-move
Parameters:
amm - auto-move mode

virtual void stopAutoMove(void)
stops camera auto-move

virtual void activation(void)
Activable activation routine callback

virtual void redraw(void)
redraw scene

virtual Vec3 getTrackballVector(int x, int y) const
get trackball location function of mouse pointer location
Returns:
trackball vector
Parameters:
x - pixel X coordinate
y - pixel Y coordinate

virtual Rotation3D getTrackballRotation(const Vec3&a, const Vec3&b)
get trackball rotation from mouse pointer move and store results in autoRotation matrix
Parameters:
a - mouse click point
b - mouse release point

virtual double getTrackballScale(const Vec3&a, const Vec3&b)
get trackball scale from mouse pointer move and store results in autoRotation matrix
Parameters:
a - mouse click point
b - mouse release point

virtual Vec3 getTrackballTranslation(const Vec3& a, const Vec3& b)
get trackball translation from mouse pointer move
Returns:
translation vector
Parameters:
a - mouse click point
b - mouse release point

virtual Vec3 getTrackballZTranslation(const double a)
get trackball translation from mouse pointer movein the Z direction
Returns:
translation vector
Parameters:
a - mouse displacement in the Z direction orthogonal to image plane

void mapworld2(const Vec2 &pixel, double *wx, double *wy)
transforms a pixel position in standard camera coordinates
Parameters:
pixel - the pixel position in the camera frame
wx - the X mouse position in standard camera coodinates
wy - the Y mouse position in standard camera coodinates

static LONGINT getRenderDuration()
returns the time needed to render the scene by the camera

static LONGINT getClickDuration()
returns the difference between the time when the mouse was clicked and the mouse button was released

BUTTON_STATE getButtonState(WHICH_BUTTON w)
get state of mouse buttons


Direct child classes:
CameraOGL

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de