RobWorkProject  23.9.11-
Public Types | Public Member Functions | Static Public Member Functions | List of all members
ProjectionMatrix Class Reference

projection matrix More...

#include <ProjectionMatrix.hpp>

Public Types

typedef rw::core::Ptr< ProjectionMatrixPtr
 

Public Member Functions

 ProjectionMatrix ()
 constructor
 
const Eigen::Matrix< double, 4, 4 > e () const
 get the boost matrix corresponding to this projection
 
bool isPerspectiveProjection ()
 test if this is a perspective projection
 
bool isOrtographicProjection ()
 test if this is a ortographic projection
 
void setOrtho (double left, double right, double bottom, double top, double zNear, double zFar)
 set the projection matrix to an ortographic projection by defining the box with length to all sides (left, right, bottom, top, near and far) More...
 
bool getOrtho (double &left, double &right, double &bottom, double &top, double &zNear, double &zFar) const
 get ortographic projection. Onli valid if isOrtographicProjection is true
 
void setFrustum (double left, double right, double bottom, double top, double zNear, double zFar)
 set the projection matrix to the viewing frustum More...
 
bool getFrustum (double &left, double &right, double &bottom, double &top, double &zNear, double &zFar) const
 get the projection matrix to the viewing frustum More...
 
void setPerspective (double fovy, double aspectRatio, double zNear, double zFar)
 set the projection matrix to perspective projection More...
 
void setPerspective (double fovy, double width, double height, double zNear, double zFar)
 set the projection matrix to perspective projection More...
 
bool getPerspective (double &fovy, double &aspectRatio, double &zNear, double &zFar) const
 get the projection matrix to perspective projection More...
 
template<class T >
void toOpenGLMatrix (T arr[16])
 convert the projection matrix to an OpenGL compatible matrix More...
 
std::pair< double, double > getClipPlanes () const
 

Static Public Member Functions

static ProjectionMatrix makePerspective (double fovy, double aspectRatio, double zNear, double zFar)
 creates a projection matrix with a perspective projection More...
 
static ProjectionMatrix makePerspective (double fovy, double width, double height, double zNear, double zFar)
 creates a projection matrix with a perspective projection More...
 
static ProjectionMatrix makeOrtho (double left, double right, double bottom, double top, double zNear, double zFar)
 creates a projection matrix with a orthographic projection More...
 

Detailed Description

projection matrix

Member Function Documentation

◆ getClipPlanes()

std::pair<double, double> getClipPlanes ( ) const

get near and far clipping plane

Returns

◆ getFrustum()

bool getFrustum ( double &  left,
double &  right,
double &  bottom,
double &  top,
double &  zNear,
double &  zFar 
) const

get the projection matrix to the viewing frustum

Parameters
left[out] distance in m near cutting plane from center to left edge
right[out] distance in m near cutting plane from center to right edge
bottom[out] distance in m near cutting plane from center to bottom edge
top[out] distance in m near cutting plane from center to top edge
zNear[out] distance in m along z-axis to near cutting plane
zFar[out] distance in m along z-axis to far cutting plane

◆ getPerspective()

bool getPerspective ( double &  fovy,
double &  aspectRatio,
double &  zNear,
double &  zFar 
) const

get the projection matrix to perspective projection

Parameters
fovy[in] vertical field of view [degrees]
aspectRatio[in] aspect ratio between width and height of image
zNear[in] distance to near cutting plane
zFar[in] distance to far cutting plane
Returns
is it succesfull

◆ makeOrtho()

static ProjectionMatrix makeOrtho ( double  left,
double  right,
double  bottom,
double  top,
double  zNear,
double  zFar 
)
static

creates a projection matrix with a orthographic projection

Parameters
left
right
bottom
top
zNear
zFar
Returns
new ProjectionMatrix.

◆ makePerspective() [1/2]

static ProjectionMatrix makePerspective ( double  fovy,
double  aspectRatio,
double  zNear,
double  zFar 
)
static

creates a projection matrix with a perspective projection

Parameters
fovy
aspectRatio
zNear
zFar
Returns
new ProjectionMatrix.

◆ makePerspective() [2/2]

static ProjectionMatrix makePerspective ( double  fovy,
double  width,
double  height,
double  zNear,
double  zFar 
)
static

creates a projection matrix with a perspective projection

Parameters
fovy[in]
width[in] of image
height[in] of image
zNear[in]
zFar[in]
Returns
new ProjectionMatrix.

◆ setFrustum()

void setFrustum ( double  left,
double  right,
double  bottom,
double  top,
double  zNear,
double  zFar 
)

set the projection matrix to the viewing frustum

Parameters
left[in] distance in m near cutting plane from center to left edge
right[in] distance in m near cutting plane from center to right edge
bottom[in] distance in m near cutting plane from center to bottom edge
top[in] distance in m near cutting plane from center to top edge
zNear[in] distance in m along z-axis to near cutting plane
zFar[in] distance in m along z-axis to far cutting plane

◆ setOrtho()

void setOrtho ( double  left,
double  right,
double  bottom,
double  top,
double  zNear,
double  zFar 
)

set the projection matrix to an ortographic projection by defining the box with length to all sides (left, right, bottom, top, near and far)

Parameters
left[in] length in m to left edge of image
right[in] length in m to right edge of image
bottom[in] length in m to bottom edge of image
top[in] length in m to top edge of image
zNear[in] length in m to near clipping plane
zFar[in] length in m to far clipping plane

◆ setPerspective() [1/2]

void setPerspective ( double  fovy,
double  aspectRatio,
double  zNear,
double  zFar 
)

set the projection matrix to perspective projection

Parameters
fovy[in] vertical field of view [degrees]
aspectRatio[in] aspect ratio between width and height of image
zNear[in] distance to near cutting plane
zFar[in] distance to far cutting plane

◆ setPerspective() [2/2]

void setPerspective ( double  fovy,
double  width,
double  height,
double  zNear,
double  zFar 
)
inline

set the projection matrix to perspective projection

Parameters
fovy[in] vertical field of view [degrees]
width[in] width of image
height[in] height of image
zNear[in] distance to near cutting plane
zFar[in] distance to far cutting plane

◆ toOpenGLMatrix()

void toOpenGLMatrix ( arr[16])
inline

convert the projection matrix to an OpenGL compatible matrix

Parameters
arr[out] array of 16*sizeof(T) with the opengl matrix

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