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

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

#include <camera.h>

Inheritance diagram for jwscxx::graphics::Camera_f:
Collaboration diagram for jwscxx::graphics::Camera_f:

List of all members.

Public Member Functions

 Camera_f (float focal_pt_x, float focal_pt_y, float focal_pt_z, float ref_pt_x, float ref_pt_y, float ref_pt_z, float up_x, float up_y, float up_z, float aperture, float clip_near, float clip_far) throw (jwscxx::base::Arg_error)
 Constructs a Camera_f.
 Camera_f (const jwsc::Vector_f *focal_pt, const jwsc::Vector_f *ref_pt, const jwsc::Vector_f *up, float aperture, float clip_near, float clip_far) throw (jwscxx::base::Arg_error)
 Constructs a Camera_f.
 Camera_f (const Camera_f &c)
 Constructs a camera by copying another.
 Camera_f (const char *fname) throw (jwscxx::base::Arg_error, jwscxx::base::IO_error)
 Reads a camera from an input file.
 Camera_f (std::istream &in) throw (jwscxx::base::Arg_error, jwscxx::base::IO_error)
 Reads a camera from an input stream.
virtual ~Camera_f ()
 Deletes this Camera_f.
virtual Camera_foperator= (const Camera_f &c)
 Copies a camera into this one.
virtual Camera_fclone () const
 Clones this camera.
const jwsc::Vector_f * get_u () const
 Returns a constant pointer to the camera right (x) vector.
const jwsc::Vector_f * get_v () const
 Returns a constant pointer to the camera up (y) vector.
const jwsc::Vector_f * get_n () const
 Returns a constant pointer to the camera -view (z) vector.
const jwsc::Vector_f * get_prp () const
 Returns a constant pointer to the camera focal point.
const jwsc::Vector_f * get_vrp () const
 Returns a constant pointer to the camera reference point.
float get_clipping_near () const
 Returns the distance to the near clipping plane.
float get_clipping_far () const
 Returns the distance to the far clipping plane.
float get_focal_length () const
 Returns the focal length.
float get_aperture () const
 Returns the aperature.
float 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 (float 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 (float 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 (float 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 (float f) throw (jwscxx::base::Arg_error)
 Sets the focal length using the same aperture by changing the vrp.
virtual void set_aperture (float aperture) throw (jwscxx::base::Arg_error)
 Sets the vertical aperture.
virtual void set_clipping (float clip_near, float clip_far) throw (jwscxx::base::Arg_error)
 Sets the clipping planes.
virtual void rotate (float angle, float x, float y, float z) throw (jwscxx::base::Arg_error)
 Rotates this Camera_f around a vector.
virtual void rotate (float angle, const jwsc::Vector_f *r) throw (jwscxx::base::Arg_error)
 Rotates this Camera_f around a vector.
virtual void translate (float x, float y, float z)
 Translates this Camera_f.
virtual void translate (const jwsc::Vector_f *t) throw (jwscxx::base::Arg_error)
 Translates this Camera_f.
virtual void look_at (float focal_pt_x, float focal_pt_y, float focal_pt_z, float ref_pt_x, float ref_pt_y, float ref_pt_z, float up_x, float up_y, float up_z) throw (jwscxx::base::Arg_error)
 Sets the position, direction and focal length of the camera.
void look_at (const jwsc::Vector_f *focal_pt, const jwsc::Vector_f *ref_pt, const jwsc::Vector_f *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_f.
virtual void set_gl_projection () const
 Sets the GL projection matrix with this Camera_f.
void get_image_pt_on_focal_plane (jwsc::Vector_f **pt_out, float x, float y)
 Calculates the R^3 world coordinates of a point on the camera focal plane.
void get_image_pt_on_focal_plane (jwsc::Vector_f **pt_out, const jwsc::Vector_f *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_f **pt_out, float x, float 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_f **pt_out, const jwsc::Vector_f *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_f **pt_out, float x, float 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_f **pt_out, const jwsc::Vector_f *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 float get_gl_viewport_aspect ()
 Returns the aspect ration of width to height for the GL viewport.
static float get_gl_viewport_width ()
 Returns the viewport width in the GL.
static float 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_f * vrp
 View reference point (center of the view-plane).
jwsc::Vector_f * prp
 Projection reference point (center of the camera).
jwsc::Vector_f * u
 View-right vector; x-axis of the view coordinates.
jwsc::Vector_f * v
 View-up vector; y-axis of the view coordinates.
jwsc::Vector_f * n
 View-plane normal; z-axis of the view coordinates.
float aperture
 Vertical aperture in degrees.
float focal_length
 Focal length along the view-plane normal from the vrp.
float half_focal_height
 Half of the height of the view plane at the focal length.
float half_near_height
 Half of the height of the near clipping plane.
float near
 Near clipping plane in the GL frustum.
float far
 Far clipping plane in the GL frustum.
jwsc::Matrix_f * R_phi
 Rotation matrix around the z-axis with angle phi.
jwsc::Matrix_f * R_theta
 Rotation matrix around the x-axis with angle theta.
jwsc::Matrix_f * R_psi
 Rotation matrix around the z-axis with angle psi.
jwsc::Matrix_f * R
 Combined psi * theta * phi * theta^T * psi^T matrix.

Detailed Description

Camera for 3D viewing in OpenGL.

Uses single precision, floating point values.

Definition at line 84 of file camera.h.


Constructor & Destructor Documentation

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

Constructs a Camera_f.

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 105 of file camera.cpp.

Camera_f::Camera_f ( const jwsc::Vector_f *  focal_pt,
const jwsc::Vector_f *  ref_pt,
const jwsc::Vector_f *  up,
float  aperture,
float  clip_near,
float  clip_far 
) throw (jwscxx::base::Arg_error)

Constructs a Camera_f.

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 164 of file camera.cpp.

Camera_f::Camera_f ( const Camera_f c)

Constructs a camera by copying another.

Parameters:
cCamera to copy into this one.

Definition at line 205 of file camera.cpp.

Camera_f::Camera_f ( 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 242 of file camera.cpp.

Camera_f::Camera_f ( 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 280 of file camera.cpp.

Camera_f::~Camera_f ( ) [virtual]

Deletes this Camera_f.

Definition at line 297 of file camera.cpp.


Member Function Documentation

Camera_f & Camera_f::operator= ( const Camera_f 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 318 of file camera.cpp.

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

Clones this camera.

Returns:
A new copy of this camera.

Implements jwscxx::base::Cloneable.

Reimplemented in jwscxx::graphics::Stereo_camera_f.

Definition at line 343 of file camera.cpp.

const jwsc::Vector_f * Camera_f::get_u ( ) const

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

Definition at line 349 of file camera.cpp.

const jwsc::Vector_f * Camera_f::get_v ( ) const

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

Definition at line 355 of file camera.cpp.

const jwsc::Vector_f * Camera_f::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 364 of file camera.cpp.

const jwsc::Vector_f * Camera_f::get_prp ( ) const

Returns a constant pointer to the camera focal point.

Definition at line 370 of file camera.cpp.

const jwsc::Vector_f * Camera_f::get_vrp ( ) const

Returns a constant pointer to the camera reference point.

Definition at line 376 of file camera.cpp.

float Camera_f::get_clipping_near ( ) const

Returns the distance to the near clipping plane.

Definition at line 382 of file camera.cpp.

float Camera_f::get_clipping_far ( ) const

Returns the distance to the far clipping plane.

Definition at line 388 of file camera.cpp.

float Camera_f::get_focal_length ( ) const

Returns the focal length.

Definition at line 394 of file camera.cpp.

float Camera_f::get_aperture ( ) const

Returns the aperature.

Definition at line 400 of file camera.cpp.

float Camera_f::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 407 of file camera.cpp.

void Camera_f::set_f_with_new_aperture_using_prp ( float  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_f.

Definition at line 440 of file camera.cpp.

void Camera_f::set_f_with_same_aperture_using_prp ( float  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_f.

Definition at line 467 of file camera.cpp.

void Camera_f::set_f_with_new_aperture_using_vrp ( float  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_f.

Definition at line 492 of file camera.cpp.

void Camera_f::set_f_with_same_aperture_using_vrp ( float  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_f.

Definition at line 519 of file camera.cpp.

void Camera_f::set_aperture ( float  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_f.

Definition at line 418 of file camera.cpp.

void Camera_f::set_clipping ( float  clip_near,
float  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_f.

Definition at line 542 of file camera.cpp.

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

Rotates this Camera_f 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_f.

Definition at line 565 of file camera.cpp.

void Camera_f::rotate ( float  phi,
const jwsc::Vector_f *  r 
) throw (jwscxx::base::Arg_error) [virtual]

Rotates this Camera_f 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_f.

Definition at line 645 of file camera.cpp.

void Camera_f::translate ( float  x,
float  y,
float  z 
) [virtual]

Translates this Camera_f.

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_f.

Definition at line 661 of file camera.cpp.

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

Translates this Camera_f.

Parameters:
tVector to translate by.

Reimplemented in jwscxx::graphics::Stereo_camera_f.

Definition at line 672 of file camera.cpp.

void Camera_f::look_at ( float  focal_pt_x,
float  focal_pt_y,
float  focal_pt_z,
float  ref_pt_x,
float  ref_pt_y,
float  ref_pt_z,
float  up_x,
float  up_y,
float  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_f.

Definition at line 698 of file camera.cpp.

void Camera_f::look_at ( const jwsc::Vector_f *  focal_pt,
const jwsc::Vector_f *  ref_pt,
const jwsc::Vector_f *  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 772 of file camera.cpp.

void Camera_f::set_gl_modelview ( ) const [virtual]

Sets the GL model view matrix with this Camera_f.

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

Definition at line 796 of file camera.cpp.

void Camera_f::set_gl_projection ( ) const [virtual]

Sets the GL projection matrix with this Camera_f.

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

Definition at line 818 of file camera.cpp.

void Camera_f::get_image_pt_on_focal_plane ( jwsc::Vector_f **  pt_out,
float  x,
float  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 847 of file camera.cpp.

void Camera_f::get_image_pt_on_focal_plane ( jwsc::Vector_f **  pt_out,
const jwsc::Vector_f *  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 897 of file camera.cpp.

void Camera_f::get_image_pt_on_near_clipping_plane ( jwsc::Vector_f **  pt_out,
float  x,
float  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 926 of file camera.cpp.

void Camera_f::get_image_pt_on_near_clipping_plane ( jwsc::Vector_f **  pt_out,
const jwsc::Vector_f *  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 977 of file camera.cpp.

void Camera_f::get_image_pt_on_far_clipping_plane ( jwsc::Vector_f **  pt_out,
float  x,
float  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 1006 of file camera.cpp.

void Camera_f::get_image_pt_on_far_clipping_plane ( jwsc::Vector_f **  pt_out,
const jwsc::Vector_f *  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 1058 of file camera.cpp.

float Camera_f::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 1074 of file camera.cpp.

float Camera_f::get_gl_viewport_width ( ) [static]

Returns the viewport width in the GL.

Returns:
The viewport width in the GL.

Definition at line 1084 of file camera.cpp.

float Camera_f::get_gl_viewport_height ( ) [static]

Returns the viewport height in the GL.

Returns:
The viewport height in the GL.

Definition at line 1094 of file camera.cpp.

void Camera_f::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 1109 of file camera.cpp.

void Camera_f::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 1145 of file camera.cpp.

void Camera_f::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 1173 of file camera.cpp.

void Camera_f::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_f.

Definition at line 1205 of file camera.cpp.

void Camera_f::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_f.

Definition at line 1389 of file camera.cpp.


Member Data Documentation

jwsc::Vector_f* jwscxx::graphics::Camera_f::vrp [protected]

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

Definition at line 406 of file camera.h.

jwsc::Vector_f* jwscxx::graphics::Camera_f::prp [protected]

Projection reference point (center of the camera).

Definition at line 409 of file camera.h.

jwsc::Vector_f* jwscxx::graphics::Camera_f::u [protected]

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

Definition at line 412 of file camera.h.

jwsc::Vector_f* jwscxx::graphics::Camera_f::v [protected]

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

Definition at line 415 of file camera.h.

jwsc::Vector_f* jwscxx::graphics::Camera_f::n [protected]

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

Definition at line 418 of file camera.h.

Vertical aperture in degrees.

Definition at line 421 of file camera.h.

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

Definition at line 424 of file camera.h.

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

Definition at line 427 of file camera.h.

Half of the height of the near clipping plane.

Definition at line 430 of file camera.h.

Near clipping plane in the GL frustum.

Definition at line 433 of file camera.h.

Far clipping plane in the GL frustum.

Definition at line 436 of file camera.h.

jwsc::Matrix_f* jwscxx::graphics::Camera_f::R_phi [protected]

Rotation matrix around the z-axis with angle phi.

Definition at line 439 of file camera.h.

jwsc::Matrix_f* jwscxx::graphics::Camera_f::R_theta [protected]

Rotation matrix around the x-axis with angle theta.

Definition at line 442 of file camera.h.

jwsc::Matrix_f* jwscxx::graphics::Camera_f::R_psi [protected]

Rotation matrix around the z-axis with angle psi.

Definition at line 445 of file camera.h.

jwsc::Matrix_f* jwscxx::graphics::Camera_f::R [protected]

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

Definition at line 448 of file camera.h.


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