ContRap-Libraries
Public Member Functions

crp::GLCamera Class Reference

Class GLCamera represents a camera with it's coordinates, direction, and internal and external characteristics. More...

#include <glcamera.h>

Public Member Functions

 GLCamera (double fov=45.0, double ratio=1.3, double w=640.0, double h=480.0)
 Constructs a new camera object with the given field of view and a ratio between the width and height of the square plane the picture is projected onto.
 GLCamera (const GLCamera &camera)
 Copy constructor of the camera.
void set_FOV (double nfov, double nratio, int w, int h)
 Sets the given field of view and a ratio between the width and height of the square plane the picture is projected onto.
void set_projection (double alpha, double beta, double xc, double yc, int w, int h)
 Sets the camera parameters from a pinhole camera model.
void move (double x, double y, double z)
 Moves the camera to a new point.
void look_at (double x, double y, double z)
 Makes the camera looking at a given point in the coordinate system.
void look_at_up (double x, double y, double z, double ux, double uy, double uz)
 Makes the camera looking at a given point in the coordinate system with orinetation given by a up-vector.
void set_up (const GLVertex &up)
 Sets the up vector of the camera.
void rotate (double yaw, double pitch, double roll)
 Rotates the camera to the given direction.
void backproject_point (double x, double y, double &dx, double &dy, double &dz)
 Computes the ray direction through an image point.
void configure ()
 Performs the camera immanent modifications for configuration of a camera, e.g.
void project ()
 Performs the camera immanent modifications of the projection matrix.
void set_smoothing (bool on)
 Sets smoothing while changing the moving point.
void render_depth (float *array)
 Renders a depth image of the lastly drawn scene into an array.
void render_RGBA (char *array)
 Renders the RGBA image into an array.
bool is_target_reached ()
 Returns true if the target position has been reached.
GLMatrix4x4get_modelview_matrix ()
 Retruns the currently applied modelview matrix.
void set_modelview_matrix (const GLMatrix4x4 &matrix)
 Sets a new target matrix.
int get_width ()
 Returns the width of the currently configured camera image.
int get_height ()
 Returns the width of the currently configured camera image.

Detailed Description

Class GLCamera represents a camera with it's coordinates, direction, and internal and external characteristics.

Author:
Aless Lasaruk <lasaruk@uni-passau.de>

Constructor & Destructor Documentation

crp::GLCamera::GLCamera ( double  fov = 45.0,
double  ratio = 1.3,
double  w = 640.0,
double  h = 480.0 
)

Constructs a new camera object with the given field of view and a ratio between the width and height of the square plane the picture is projected onto.

Parameters:
fovis the field of view.
ratiois the screen width/height ratio.
wWidth of the image in pixels
hHeight of the image in pixels
crp::GLCamera::GLCamera ( const GLCamera camera)

Copy constructor of the camera.

This constructor does not copy rgba maps or range maps.

Parameters:
cameraCamera to copy from

Member Function Documentation

void crp::GLCamera::backproject_point ( double  x,
double  y,
double &  dx,
double &  dy,
double &  dz 
)

Computes the ray direction through an image point.

Parameters:
xX-Coordinate of the image point
yY-Coordinate of the image point
dxX-Coordinate of the ray direction
dyY-Coordinate of the ray direction
dzZ-Coordinate of the ray direction
void crp::GLCamera::configure ( )

Performs the camera immanent modifications for configuration of a camera, e.g.

as viewport setting

int crp::GLCamera::get_height ( ) [inline]

Returns the width of the currently configured camera image.

Returns:
Width of the image
GLMatrix4x4& crp::GLCamera::get_modelview_matrix ( )

Retruns the currently applied modelview matrix.

int crp::GLCamera::get_width ( ) [inline]

Returns the width of the currently configured camera image.

Returns:
Width of the image
bool crp::GLCamera::is_target_reached ( )

Returns true if the target position has been reached.

Returns:
True if the camera position is reached
void crp::GLCamera::look_at ( double  x,
double  y,
double  z 
)

Makes the camera looking at a given point in the coordinate system.

Parameters:
xX-coordinate of the new looking direction
yY-coordinate of the new looking direction
zZ-coordinate of the new looking direction
void crp::GLCamera::look_at_up ( double  x,
double  y,
double  z,
double  ux,
double  uy,
double  uz 
)

Makes the camera looking at a given point in the coordinate system with orinetation given by a up-vector.

Parameters:
xX-coordinate of the new looking direction
yY-coordinate of the new looking direction
zZ-coordinate of the new looking direction
uxX-coordinate of the new up-dircetion
uyY-coordinate of the new up-direction
uzZ-coordinate of the new up-direction
void crp::GLCamera::move ( double  x,
double  y,
double  z 
)

Moves the camera to a new point.

Parameters:
xX-coordinate of the new position
yY-coordinate of the new position
zZ-coordinate of the new position
void crp::GLCamera::project ( )

Performs the camera immanent modifications of the projection matrix.

void crp::GLCamera::render_depth ( float *  array)

Renders a depth image of the lastly drawn scene into an array.

Parameters:
arrayArray to render the data (must be sufficiently large)
linear_transformArray of the double size of array, where each two neighbored floats are the factors $d(z) = az+b$.
void crp::GLCamera::render_RGBA ( char *  array)

Renders the RGBA image into an array.

Parameters:
arrayArray to render the data (must be sufficiently large, at least width*height*4)
void crp::GLCamera::rotate ( double  yaw,
double  pitch,
double  roll 
)

Rotates the camera to the given direction.

Parameters:
yawYaw of the new rotation
pitchPitch of the new rotation
rollRoll of the new rotation
void crp::GLCamera::set_FOV ( double  nfov,
double  nratio,
int  w,
int  h 
)

Sets the given field of view and a ratio between the width and height of the square plane the picture is projected onto.

Parameters:
nfovis the new field of view.
nratiois the new screen width/height ratio.
wWidth of the image in pixels
hHeight of the image in pixels
void crp::GLCamera::set_modelview_matrix ( const GLMatrix4x4 matrix)

Sets a new target matrix.

Parameters:
matrixNew model view matrix
void crp::GLCamera::set_projection ( double  alpha,
double  beta,
double  xc,
double  yc,
int  w,
int  h 
)

Sets the camera parameters from a pinhole camera model.

Parameters:
alphaFocal length divided by the pixel width
betaFocal length divided by the pixel height
xcX-Coordinate of the image center
ycY-Coordinate of the image center
wWidth of the image in pixels
hHeight of the image in pixels
void crp::GLCamera::set_smoothing ( bool  on)

Sets smoothing while changing the moving point.

That means that each time move or lookAt or rotate is called the camera data is changed slightly.

Parameters:
onis the turn flag
void crp::GLCamera::set_up ( const GLVertex up)

Sets the up vector of the camera.

Parameters:
directionNew up direction.

The documentation for this class was generated from the following file: