JWS C++ Library
C++ language utility library
jwscxx::graphics::Camera_d Class Reference

Camera for 3D viewing in OpenGL. More...

#include <camera.h>

Inheritance diagram for jwscxx::graphics::Camera_d:
Collaboration diagram for jwscxx::graphics::Camera_d:

List of all members.

Public Member Functions

 Camera_d (double focal_pt_x, double focal_pt_y, double focal_pt_z, double ref_pt_x, double ref_pt_y, double ref_pt_z, double up_x, double up_y, double up_z, double aperture, double clip_near, double clip_far) throw (jwscxx::base::Arg_error)
 Constructs a Camera_d.
 Camera_d (const jwsc::Vector_d *focal_pt, const jwsc::Vector_d *ref_pt, const jwsc::Vector_d *up, double aperture, double clip_near, double clip_far) throw (jwscxx::base::Arg_error)
 Constructs a Camera_d.
 Camera_d (const Camera_d &c)
 Constructs a camera by copying another.
 Camera_d (const char *fname) throw (jwscxx::base::Arg_error, jwscxx::base::IO_error)
 Reads a camera from an input file.
 Camera_d (std::istream &in) throw (jwscxx::base::Arg_error, jwscxx::base::IO_error)
 Reads a camera from an input stream.
virtual ~Camera_d ()
 Deletes this Camera_d.
virtual Camera_doperator= (const Camera_d &c)
 Copies a camera into this one.
virtual Camera_dclone () const
 Clones this camera.
const jwsc::Vector_d * get_u () const
 Returns a constant pointer to the camera right (x) vector.
const jwsc::Vector_d * get_v () const
 Returns a constant pointer to the camera up (y) vector.
const jwsc::Vector_d * get_n () const
 Returns a constant pointer to the camera -view (z) vector.
const jwsc::Vector_d * get_prp () const
 Returns a constant pointer to the camera focal point.
const jwsc::Vector_d * get_vrp () const
 Returns a constant pointer to the camera reference point.
double get_clipping_near () const
 Returns the distance to the near clipping plane.
double get_clipping_far () const
 Returns the distance to the far clipping plane.
double get_focal_length () const
 Returns the focal length.
double get_aperture () const
 Returns the aperature.
double get_half_focal_height () const
 Returns half the height of the image plane at the focal length.
virtual void set_f_with_new_aperture_using_prp (double f) throw (jwscxx::base::Arg_error)
 Sets the focal length and updates the aperture by changing the left and right prp.
virtual void set_f_with_same_aperture_using_prp (double f) throw (jwscxx::base::Arg_error)
 Sets the focal length using the same aperture by changing the left and right prp.
virtual void set_f_with_new_aperture_using_vrp (double f) throw (jwscxx::base::Arg_error)
 Sets the focal length and updates the aperture by changing the vrp.
virtual void set_f_with_same_aperture_using_vrp (double f) throw (jwscxx::base::Arg_error)
 Sets the focal length using the same aperture by changing the vrp.
virtual void set_aperture (double aperture) throw (jwscxx::base::Arg_error)
 Sets the vertical aperture.
virtual void set_clipping (double clip_near, double clip_far) throw (jwscxx::base::Arg_error)
 Sets the clipping planes.
virtual void rotate (double angle, double x, double y, double z) throw (jwscxx::base::Arg_error)
 Rotates this Camera_d around a vector.
virtual void rotate (double angle, const jwsc::Vector_d *r) throw (jwscxx::base::Arg_error)
 Rotates this Camera_d around a vector.
virtual void translate (double x, double y, double z)
 Translates this Camera_d.
virtual void translate (const jwsc::Vector_d *t) throw (jwscxx::base::Arg_error)
 Translates this Camera_d.
virtual void look_at (double focal_pt_x, double focal_pt_y, double focal_pt_z, double ref_pt_x, double ref_pt_y, double ref_pt_z, double up_x, double up_y, double up_z) throw (jwscxx::base::Arg_error)
 Sets the position, direction and focal length of the camera.
void look_at (const jwsc::Vector_d *focal_pt, const jwsc::Vector_d *ref_pt, const jwsc::Vector_d *up) throw (jwscxx::base::Arg_error)
 Sets the position, direction and focal length of the camera.
virtual void set_gl_modelview () const
 Sets the GL model view matrix with this Camera_d.
virtual void set_gl_projection () const
 Sets the GL projection matrix with this Camera_d.
void get_image_pt_on_focal_plane (jwsc::Vector_d **pt_out, double x, double y)
 Calculates the R^3 world coordinates of a point on the camera focal plane.
void get_image_pt_on_focal_plane (jwsc::Vector_d **pt_out, const jwsc::Vector_d *pt_in) throw (jwscxx::base::Arg_error)
 Calculates the R^3 world coordinates of a point on the camera focal plane.
void get_image_pt_on_near_clipping_plane (jwsc::Vector_d **pt_out, double x, double y)
 Calculates the R^3 world coordinates of a point on the near camera clipping plane.
void get_image_pt_on_near_clipping_plane (jwsc::Vector_d **pt_out, const jwsc::Vector_d *pt_in) throw (jwscxx::base::Arg_error)
 Calculates the R^3 world coordinates of a point on the near camera clipping plane.
void get_image_pt_on_far_clipping_plane (jwsc::Vector_d **pt_out, double x, double y)
 Calculates the R^3 world coordinates of a point on the far camera clipping plane.
void get_image_pt_on_far_clipping_plane (jwsc::Vector_d **pt_out, const jwsc::Vector_d *pt_in) throw (jwscxx::base::Arg_error)
 Calculates the R^3 world coordinates of a point on the far camera clipping plane.
virtual void read (std::istream &in) throw (jwscxx::base::IO_error, jwscxx::base::Arg_error)
 Reads this camera from an input stream.
virtual void write (std::ostream &out) const throw (jwscxx::base::IO_error)
 Writes this camera to an output stream.

Static Public Member Functions

static double get_gl_viewport_aspect ()
 Returns the aspect ration of width to height for the GL viewport.
static double get_gl_viewport_width ()
 Returns the viewport width in the GL.
static double get_gl_viewport_height ()
 Returns the viewport height in the GL.
static void capture_gl_view (jwsc::Image_f **img_out)
 Captures an image from the GL view (image) plane.
static void capture_gl_view (const char *fname) throw (jwscxx::base::IO_error)
 Captures an image from the GL view (image) plane.
static void capture_gl_view (const char *fname_base, uint32_t N) throw (jwscxx::base::IO_error)
 Captures an image from the GL view (image) plane.

Protected Attributes

jwsc::Vector_d * vrp
 View reference point (center of the view-plane).
jwsc::Vector_d * prp
 Projection reference point (center of the camera).
jwsc::Vector_d * u
 View-right vector; x-axis of the view coordinates.
jwsc::Vector_d * v
 View-up vector; y-axis of the view coordinates.
jwsc::Vector_d * n
 View-plane normal; z-axis of the view coordinates.
double aperture
 Vertical aperture in degrees.
double focal_length
 Focal length along the view-plane normal from the vrp.
double half_focal_height
 Half of the height of the view plane at the focal length.
double half_near_height
 Half of the height of the near clipping plane.
double near
 Near clipping plane in the GL frustum.
double far
 Far clipping plane in the GL frustum.
jwsc::Matrix_d * R_phi
 Rotation matrix around the z-axis with angle phi.
jwsc::Matrix_d * R_theta
 Rotation matrix around the x-axis with angle theta.
jwsc::Matrix_d * R_psi
 Rotation matrix around the z-axis with angle psi.
jwsc::Matrix_d * R
 Combined psi * theta * phi * theta^T * psi^T matrix.

Detailed Description

Camera for 3D viewing in OpenGL.

Uses double precision, floating point values.

Definition at line 461 of file camera.h.


Constructor & Destructor Documentation

Camera_d::Camera_d ( double  focal_pt_x,
double  focal_pt_y,
double  focal_pt_z,
double  ref_pt_x,
double  ref_pt_y,
double  ref_pt_z,
double  up_x,
double  up_y,
double  up_z,
double  aperture,
double  clip_near,
double  clip_far 
) throw (jwscxx::base::Arg_error)

Constructs a Camera_d.

Parameters:
focal_pt_xX-coord of the focal point.
focal_pt_yY-coord of the focal point.
focal_pt_zZ-coord of the focal point.
ref_pt_xX-coord of the reference point.
ref_pt_yY-coord of the reference point.
ref_pt_zZ-coord of the reference point.
up_xX-coord of the up vector.
up_yY-coord of the up vector.
up_zZ-coord of the up vector.
apertureAngle, in degrees, of the vertical field of view.
clip_nearNear clipping plane for the GL frustum. Must be >= 0.
clip_farFar clipping plane for the GL frustum. Must be >= 0.
Exceptions:
jwscxx::base::Arg_errorInvalid up vector, aperture, or clipping planes.

Definition at line 1432 of file camera.cpp.

Camera_d::Camera_d ( const jwsc::Vector_d *  focal_pt,
const jwsc::Vector_d *  ref_pt,
const jwsc::Vector_d *  up,
double  aperture,
double  clip_near,
double  clip_far 
) throw (jwscxx::base::Arg_error)

Constructs a Camera_d.

Parameters:
focal_ptFocal point.
ref_ptReference point.
upUp vector.
apertureAngle, in degrees, of the vertical field of view.
clip_nearNear clipping plane for the GL frustum. Must be >= 0.
clip_farFar clipping plane for the GL frustum. Must be >= 0.
Exceptions:
jwscxx::base::Arg_errorInvalid up vector, aperture, or clipping planes.

Definition at line 1491 of file camera.cpp.

Camera_d::Camera_d ( const Camera_d c)

Constructs a camera by copying another.

Parameters:
cCamera to copy into this one.

Definition at line 1532 of file camera.cpp.

Camera_d::Camera_d ( const char *  fname) throw (jwscxx::base::Arg_error, jwscxx::base::IO_error)

Reads a camera from an input file.

The file format is expected to be in ASCII as follows

       Type: type_info name
        VRP: x y z
        PRP: x y z
          U: x y z
          V: x y z
          N: x y z
          F: focal_length
   Aperture: aperture   
       Near: near
        Far: far
Parameters:
fnameInput file to read this camera from.
Exceptions:
jwscxx::base::IO_errorCould not read from in.
jwscxx::base::Arg_errorInvalid arguments in file to read from.

Definition at line 1569 of file camera.cpp.

Camera_d::Camera_d ( std::istream &  in) throw (jwscxx::base::Arg_error, jwscxx::base::IO_error)

Reads a camera from an input stream.

The file format is expected to be in ASCII as follows

       Type: type_info name
        VRP: x y z
        PRP: x y z
          U: x y z
          V: x y z
          N: x y z
          F: focal_length
   Aperture: aperture   
       Near: near
        Far: far
Parameters:
inInput stream to read this camera from.
Exceptions:
jwscxx::base::IO_errorCould not read from in.
jwscxx::base::Arg_errorInvalid arguments in file to read from.

Definition at line 1607 of file camera.cpp.

Camera_d::~Camera_d ( ) [virtual]

Deletes this Camera_d.

Definition at line 1624 of file camera.cpp.


Member Function Documentation

Camera_d & Camera_d::operator= ( const Camera_d c) [virtual]

Copies a camera into this one.

Performs a deep copy of this camera.

Parameters:
cCamera to copy into this one.
Returns:
A reference to this camera.

Definition at line 1645 of file camera.cpp.

Camera_d * Camera_d::clone ( ) const [virtual]

Clones this camera.

Returns:
A new copy of this camera.

Implements jwscxx::base::Cloneable.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1670 of file camera.cpp.

const jwsc::Vector_d * Camera_d::get_u ( ) const

Returns a constant pointer to the camera right (x) vector.

Definition at line 1676 of file camera.cpp.

const jwsc::Vector_d * Camera_d::get_v ( ) const

Returns a constant pointer to the camera up (y) vector.

Definition at line 1682 of file camera.cpp.

const jwsc::Vector_d * Camera_d::get_n ( ) const

Returns a constant pointer to the camera -view (z) vector.

Note:
This vector is in the opposite direction as the view.

Definition at line 1691 of file camera.cpp.

const jwsc::Vector_d * Camera_d::get_prp ( ) const

Returns a constant pointer to the camera focal point.

Definition at line 1697 of file camera.cpp.

const jwsc::Vector_d * Camera_d::get_vrp ( ) const

Returns a constant pointer to the camera reference point.

Definition at line 1703 of file camera.cpp.

double Camera_d::get_clipping_near ( ) const

Returns the distance to the near clipping plane.

Definition at line 1709 of file camera.cpp.

double Camera_d::get_clipping_far ( ) const

Returns the distance to the far clipping plane.

Definition at line 1715 of file camera.cpp.

double Camera_d::get_focal_length ( ) const

Returns the focal length.

Definition at line 1721 of file camera.cpp.

double Camera_d::get_aperture ( ) const

Returns the aperature.

Definition at line 1727 of file camera.cpp.

double Camera_d::get_half_focal_height ( ) const

Returns half the height of the image plane at the focal length.

Returns:
Half the height of the image plane at the focal length.

Definition at line 1734 of file camera.cpp.

void Camera_d::set_f_with_new_aperture_using_prp ( double  f) throw (jwscxx::base::Arg_error) [virtual]

Sets the focal length and updates the aperture by changing the left and right prp.

In order to keep the size of the view the same, computes a new aperture from the new focal length.

Parameters:
fNew focal length.
Exceptions:
jwscxx::base::Arg_errorInvalid focal length.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1767 of file camera.cpp.

void Camera_d::set_f_with_same_aperture_using_prp ( double  f) throw (jwscxx::base::Arg_error) [virtual]

Sets the focal length using the same aperture by changing the left and right prp.

The aperture is not changed, instead the size of the image plane is changed.

Parameters:
fNew focal length.
Exceptions:
jwscxx::base::Arg_errorInvalid focal length.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1794 of file camera.cpp.

void Camera_d::set_f_with_new_aperture_using_vrp ( double  f) throw (jwscxx::base::Arg_error) [virtual]

Sets the focal length and updates the aperture by changing the vrp.

The aperture is updated to make the image plane the same size with the new focal length.

Parameters:
fNew focal length.
Exceptions:
jwscxx::base::Arg_errorInvalid focal length.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1819 of file camera.cpp.

void Camera_d::set_f_with_same_aperture_using_vrp ( double  f) throw (jwscxx::base::Arg_error) [virtual]

Sets the focal length using the same aperture by changing the vrp.

The aperture is not changed, instead the size of the image plane is changed.

Parameters:
fNew focal length.
Exceptions:
jwscxx::base::Arg_errorInvalid focal length.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1846 of file camera.cpp.

void Camera_d::set_aperture ( double  aperture) throw (jwscxx::base::Arg_error) [virtual]

Sets the vertical aperture.

Parameters:
apertureNew vertical aperture, in degrees.
Exceptions:
jwscxx::base::Arg_errorAngle must be >= 0.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1745 of file camera.cpp.

void Camera_d::set_clipping ( double  clip_near,
double  clip_far 
) throw (jwscxx::base::Arg_error) [virtual]

Sets the clipping planes.

Parameters:
clip_nearNear clipping plane for the GL frustum. Must be >= 0.
clip_farFar clipping plane for the GL frustum. Must be >= 0.
Exceptions:
jwscxx::base::Arg_errorInvalid clipping planes.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1869 of file camera.cpp.

void Camera_d::rotate ( double  phi,
double  x,
double  y,
double  z 
) throw (jwscxx::base::Arg_error) [virtual]

Rotates this Camera_d around a vector.

Parameters:
phiAngle to rotate, in radians. Use a positive value for clockwise, negative for counter-clockwise.
xX-coord of the vector to rotate around.
yY-coord of the vector to rotate around.
zZ-coord of the vector to rotate around.
Exceptions:
jwscxx::base::Arg_errorInvalid vector to rotate around.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1892 of file camera.cpp.

void Camera_d::rotate ( double  phi,
const jwsc::Vector_d *  r 
) throw (jwscxx::base::Arg_error) [virtual]

Rotates this Camera_d around a vector.

Parameters:
phiAngle to rotate, in radians. Use a positive value for clockwise, negative for counter-clockwise.
rVector to rotate around.
Exceptions:
jwscxx::base::Arg_errorInvalid vector to rotate around.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1973 of file camera.cpp.

void Camera_d::translate ( double  x,
double  y,
double  z 
) [virtual]

Translates this Camera_d.

Parameters:
xX-coord of the vector to translate by.
yY-coord of the vector to translate by.
zZ-coord of the vector to translate by.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 1989 of file camera.cpp.

void Camera_d::translate ( const jwsc::Vector_d *  t) throw (jwscxx::base::Arg_error) [virtual]

Translates this Camera_d.

Parameters:
tVector to translate by.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 2000 of file camera.cpp.

void Camera_d::look_at ( double  focal_pt_x,
double  focal_pt_y,
double  focal_pt_z,
double  ref_pt_x,
double  ref_pt_y,
double  ref_pt_z,
double  up_x,
double  up_y,
double  up_z 
) throw (jwscxx::base::Arg_error) [virtual]

Sets the position, direction and focal length of the camera.

Parameters:
focal_pt_xX-coord of the focal point.
focal_pt_yY-coord of the focal point.
focal_pt_zZ-coord of the focal point.
ref_pt_xX-coord of the reference point.
ref_pt_yY-coord of the reference point.
ref_pt_zZ-coord of the reference point.
up_xX-coord of the up vector.
up_yY-coord of the up vector.
up_zZ-coord of the up vector.
Exceptions:
jwscxx::base::Arg_errorInvalid arguments.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 2026 of file camera.cpp.

void Camera_d::look_at ( const jwsc::Vector_d *  focal_pt,
const jwsc::Vector_d *  ref_pt,
const jwsc::Vector_d *  up 
) throw (jwscxx::base::Arg_error)

Sets the position, direction and focal length of the camera.

Parameters:
focal_ptFocal point.
ref_ptReference point.
upUp vector.
Exceptions:
jwscxx::base::Arg_errorInvalid arguments.

Definition at line 2100 of file camera.cpp.

void Camera_d::set_gl_modelview ( ) const [virtual]

Sets the GL model view matrix with this Camera_d.

Switches the GL matrix mode to GL_MODELVIEW, loads the identity matrix, and multiplies the camera rotation and translation matrices.

Definition at line 2124 of file camera.cpp.

void Camera_d::set_gl_projection ( ) const [virtual]

Sets the GL projection matrix with this Camera_d.

Switches the GL matrix mode to GL_PROJECTION, loads the identity matrix, and sets the perspective frustum.

Definition at line 2146 of file camera.cpp.

void Camera_d::get_image_pt_on_focal_plane ( jwsc::Vector_d **  pt_out,
double  x,
double  y 
)

Calculates the R^3 world coordinates of a point on the camera focal plane.

The center of the image is (u,v) = (0,0), where increasing u is up and increasing v is to the right.

When the function returns, *pt_out is an R^3 vector representing the point (u,v) on the camera focal plane in world coordinates.

Parameters:
pt_outResult parameter. If *pt_out == 0, then a vector is allocated; otherwise, its space is re-used.
xX-coordinate of the point on the image plane.
yY-coordinate of the point on the image plane.

Definition at line 2175 of file camera.cpp.

void Camera_d::get_image_pt_on_focal_plane ( jwsc::Vector_d **  pt_out,
const jwsc::Vector_d *  pt_in 
) throw (jwscxx::base::Arg_error)

Calculates the R^3 world coordinates of a point on the camera focal plane.

The center of the image is (u,v) = (0,0), where increasing u is up and increasing v is to the right.

When the function returns, *pt_out is an R^3 vector representing the point (u,v) on the camera focal plane in world coordinates.

Parameters:
pt_outResult parameter. If *pt_out == 0, then a vector is allocated; otherwise, its space is re-used.
pt_inPoint on the image plane.
Exceptions:
jwscxx::base::Arg_errorpt_in is not an R^2 vector.

Definition at line 2225 of file camera.cpp.

void Camera_d::get_image_pt_on_near_clipping_plane ( jwsc::Vector_d **  pt_out,
double  x,
double  y 
)

Calculates the R^3 world coordinates of a point on the near camera clipping plane.

The center of the image is (u,v) = (0,0), where increasing u is up and increasing v is to the right.

When the function returns, *pt_out is an R^3 vector representing the point (u,v) projected onto the near camera clipping plane in world coordinates.

Parameters:
pt_outResult parameter. If *pt_out == 0, then a vector is allocated; otherwise, its space is re-used.
xX-coordinate of the point on the image plane.
yY-coordinate of the point on the image plane.

Definition at line 2254 of file camera.cpp.

void Camera_d::get_image_pt_on_near_clipping_plane ( jwsc::Vector_d **  pt_out,
const jwsc::Vector_d *  pt_in 
) throw (jwscxx::base::Arg_error)

Calculates the R^3 world coordinates of a point on the near camera clipping plane.

The center of the image is (u,v) = (0,0), where increasing u is up and increasing v is to the right.

When the function returns, *pt_out is an R^3 vector representing the point (u,v) projected onto the near camera clipping plane in world coordinates.

Parameters:
pt_outResult parameter. If *pt_out == 0, then a vector is allocated; otherwise, its space is re-used.
pt_inPoint on the image plane.
Exceptions:
jwscxx::base::Arg_errorpt_in is not an R^2 vector.

Definition at line 2305 of file camera.cpp.

void Camera_d::get_image_pt_on_far_clipping_plane ( jwsc::Vector_d **  pt_out,
double  x,
double  y 
)

Calculates the R^3 world coordinates of a point on the far camera clipping plane.

The center of the image is (u,v) = (0,0), where increasing u is up and increasing v is to the right.

When the function returns, *pt_out is an R^3 vector representing the point (u,v) projected onto the far camera clipping plane in world coordinates.

Parameters:
pt_outResult parameter. If *pt_out == 0, then a vector is allocated; otherwise, its space is re-used.
xX-coordinate of the point on the image plane.
yY-coordinate of the point on the image plane.

Definition at line 2334 of file camera.cpp.

void Camera_d::get_image_pt_on_far_clipping_plane ( jwsc::Vector_d **  pt_out,
const jwsc::Vector_d *  pt_in 
) throw (jwscxx::base::Arg_error)

Calculates the R^3 world coordinates of a point on the far camera clipping plane.

The center of the image is (u,v) = (0,0), where increasing u is up and increasing v is to the right.

When the function returns, *pt_out is an R^3 vector representing the point (u,v) projected onto the far camera clipping plane in world coordinates.

Parameters:
pt_outResult parameter. If *pt_out == 0, then a vector is allocated; otherwise, its space is re-used.
pt_inPoint on the image plane.
Exceptions:
jwscxx::base::Arg_errorpt_in is not an R^2 vector.

Definition at line 2386 of file camera.cpp.

double Camera_d::get_gl_viewport_aspect ( ) [static]

Returns the aspect ration of width to height for the GL viewport.

Returns:
The aspect ration of width to height for the GL viewport.

Definition at line 2402 of file camera.cpp.

double Camera_d::get_gl_viewport_width ( ) [static]

Returns the viewport width in the GL.

Returns:
The viewport width in the GL.

Definition at line 2412 of file camera.cpp.

double Camera_d::get_gl_viewport_height ( ) [static]

Returns the viewport height in the GL.

Returns:
The viewport height in the GL.

Definition at line 2422 of file camera.cpp.

void Camera_d::capture_gl_view ( jwsc::Image_f **  img_out) [static]

Captures an image from the GL view (image) plane.

Parameters:
img_outResult parameter. If *img_out is 0, an image is allocated; otherwise its space is re-used.
Exceptions:
jwscxx::base::IO_error

Definition at line 2437 of file camera.cpp.

void Camera_d::capture_gl_view ( const char *  fname) throw (jwscxx::base::IO_error) [static]

Captures an image from the GL view (image) plane.

Parameters:
fnameFile name to write the captured view image to.
Exceptions:
jwscxx::base::IO_error

Definition at line 2473 of file camera.cpp.

void Camera_d::capture_gl_view ( const char *  fname_fmt,
uint32_t  N 
) throw (jwscxx::base::IO_error) [static]

Captures an image from the GL view (image) plane.

An example for fname_fmt is

 image-%04d.tiff 
Parameters:
fname_fmtFormat for the file name with one printf style integer conversion for the file number.
NNumber of the captured image.
Exceptions:
jwscxx::base::IO_error

Definition at line 2501 of file camera.cpp.

void Camera_d::read ( std::istream &  in) throw (jwscxx::base::IO_error, jwscxx::base::Arg_error) [virtual]

Reads this camera from an input stream.

The file format is expected to be in ASCII as follows

       Type: type_info name
        VRP: x y z
        PRP: x y z
          U: x y z
          V: x y z
          N: x y z
          F: focal_length
   Aperture: aperture   
       Near: near
        Far: far
Parameters:
inInput stream to read this camera from.
Exceptions:
jwscxx::base::IO_errorCould not read from in.
jwscxx::base::Arg_errorInvalid arguments in the file to read from.

Implements jwscxx::base::Readable.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 2533 of file camera.cpp.

void Camera_d::write ( std::ostream &  out) const throw (jwscxx::base::IO_error) [virtual]

Writes this camera to an output stream.

The file format is in ASCII as follows

       Type: type_info name
        VRP: x y z
        PRP: x y z
          U: x y z
          V: x y z
          N: x y z
          F: focal_length
   Aperture: aperture   
       Near: near
        Far: far
Parameters:
outOutput stream to write this camera to.
Exceptions:
jwscxx::base::IO_errorCould not write to out.

Implements jwscxx::base::Writeable.

Reimplemented in jwscxx::graphics::Stereo_camera_d.

Definition at line 2717 of file camera.cpp.


Member Data Documentation

jwsc::Vector_d* jwscxx::graphics::Camera_d::vrp [protected]

View reference point (center of the view-plane).

Definition at line 787 of file camera.h.

jwsc::Vector_d* jwscxx::graphics::Camera_d::prp [protected]

Projection reference point (center of the camera).

Definition at line 790 of file camera.h.

jwsc::Vector_d* jwscxx::graphics::Camera_d::u [protected]

View-right vector; x-axis of the view coordinates.

Definition at line 793 of file camera.h.

jwsc::Vector_d* jwscxx::graphics::Camera_d::v [protected]

View-up vector; y-axis of the view coordinates.

Definition at line 796 of file camera.h.

jwsc::Vector_d* jwscxx::graphics::Camera_d::n [protected]

View-plane normal; z-axis of the view coordinates.

Definition at line 799 of file camera.h.

Vertical aperture in degrees.

Definition at line 802 of file camera.h.

Focal length along the view-plane normal from the vrp.

Definition at line 805 of file camera.h.

Half of the height of the view plane at the focal length.

Definition at line 808 of file camera.h.

Half of the height of the near clipping plane.

Definition at line 811 of file camera.h.

Near clipping plane in the GL frustum.

Definition at line 814 of file camera.h.

double jwscxx::graphics::Camera_d::far [protected]

Far clipping plane in the GL frustum.

Definition at line 817 of file camera.h.

jwsc::Matrix_d* jwscxx::graphics::Camera_d::R_phi [protected]

Rotation matrix around the z-axis with angle phi.

Definition at line 820 of file camera.h.

jwsc::Matrix_d* jwscxx::graphics::Camera_d::R_theta [protected]

Rotation matrix around the x-axis with angle theta.

Definition at line 823 of file camera.h.

jwsc::Matrix_d* jwscxx::graphics::Camera_d::R_psi [protected]

Rotation matrix around the z-axis with angle psi.

Definition at line 826 of file camera.h.

jwsc::Matrix_d* jwscxx::graphics::Camera_d::R [protected]

Combined psi * theta * phi * theta^T * psi^T matrix.

Definition at line 829 of file camera.h.


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