OGLplus (0.52.0) a C++ wrapper for OpenGL

Class implementing camera matrix named constructors. More...

#include </home/chochlik/devel/oglplus/include/oglplus/math/matrix.hpp>

Inheritance diagram for oglplus::CameraMatrix< T >:
Collaboration diagram for oglplus::CameraMatrix< T >:

Public Member Functions

 CameraMatrix (void)
 Constructs an identity matrix.
 
const TData (void) const
 Returns a pointer to the matrix elements in row major order.
 
std::size_t Size (void) const
 Returns the number of elements of the matrix.
 
T At (std::size_t i, std::size_t j) const
 Returns the value of the element at position i, j. More...
 
void Set (std::size_t i, std::size_t j, T v)
 Sets the value of the element at position i, j. More...
 
Vector< T, ColsRow (std::size_t i) const
 Returns the i-th row of this matrix. More...
 
Vector< T, RowsCol (std::size_t j) const
 Return the j-th column of this matrix. More...
 
Matrix< T, R, C > Submatrix (void) const
 Submatrix extraction.
 

Static Public Member Functions

static CameraMatrix Perspective (T x_left, T x_right, T y_bottom, T y_top, T z_near, T z_far)
 Constructs a perspective projection matrix. More...
 
static CameraMatrix PerspectiveX (Angle< T > xfov, T aspect, T z_near, T z_far)
 Constructs a perspective projection matrix. More...
 
static CameraMatrix PerspectiveY (Angle< T > yfov, T aspect, T z_near, T z_far)
 Constructs a perspective projection matrix. More...
 
static CameraMatrix Ortho (T x_left, T x_right, T y_bottom, T y_top, T z_near, T z_far)
 Constructs an orthographic projection matrix. More...
 
static CameraMatrix OrthoX (T width, T aspect, T z_near, T z_far)
 Constructs an orthographic projection matrix. More...
 
static CameraMatrix OrthoY (T height, T aspect, T z_near, T z_far)
 Constructs an orthographic projection matrix. More...
 
static CameraMatrix ScreenStretch (T x_left, T x_right, T y_bottom, T y_top)
 Constructs a matrix for stretching NDCs after projection. More...
 
static CameraMatrix ScreenTile (unsigned x, unsigned y, unsigned nx, unsigned ny)
 Constructs a matrix for stretching NDCs after projection. More...
 
static CameraMatrix LookingAt (const Vector< T, 3 > &eye, const Vector< T, 3 > &target)
 Constructs a 'look-at' matrix from eye and target positions.
 
static CameraMatrix LookingAt (const Vector< T, 3 > &eye, const Vector< T, 3 > &target, const Vector< T, 3 > &up)
 Constructs 'look-at' matrix from eye and target positions and up vector.
 
static CameraMatrix Orbiting (const Vector< T, 3 > &target, T radius, Angle< T > azimuth, Angle< T > elevation)
 Constructs a matrix from target, radius, azimuth and elevation.
 
static CameraMatrix Pitch (Angle< T > angle)
 Constructs a X-axis rotation (Pitch/Elevation) matrix. More...
 
static CameraMatrix Yaw (Angle< T > angle)
 Constructs a Y-axis rotation (Heading/Yaw) matrix. More...
 
static CameraMatrix Roll (Angle< T > angle)
 Constructs a Z-axis rotation (Bank/Roll) matrix. More...
 

Detailed Description

template<typename T>
class oglplus::CameraMatrix< T >

Class implementing camera matrix named constructors.

The static methods of this class can be used for the construction of various camera matrices.

Member Function Documentation

T oglplus::Matrix< T, Rows, Cols >::At ( std::size_t  i,
std::size_t  j 
) const
inherited

Returns the value of the element at position i, j.

Precondition
(i < Rows) && (j < Cols)
Vector<T, Rows> oglplus::Matrix< T, Rows, Cols >::Col ( std::size_t  j) const
inherited

Return the j-th column of this matrix.

Precondition
(j < Cols)
template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::Ortho ( T  x_left,
T  x_right,
T  y_bottom,
T  y_top,
T  z_near,
T  z_far 
)
static

Constructs an orthographic projection matrix.

Creates a new orthographic matrix from the x-axis x_left, x_right, y-axis y_bottom, y_top and z-axis z_near and z_far values

template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::OrthoX ( T  width,
T  aspect,
T  z_near,
T  z_far 
)
static

Constructs an orthographic projection matrix.

Creates a new orthographic matrix from x-axis width, x/y aspect ratio and z-axis z_near and z_far planes

template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::OrthoY ( T  height,
T  aspect,
T  z_near,
T  z_far 
)
static

Constructs an orthographic projection matrix.

Creates a new orthographic matrix from y-axis height, x/y aspect ratio and z-axis z_near and z_far planes

template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::Perspective ( T  x_left,
T  x_right,
T  y_bottom,
T  y_top,
T  z_near,
T  z_far 
)
static

Constructs a perspective projection matrix.

Creates a new perspective matrix from x_left, x_right, y_botton, y_top, z_near and z_far values.

template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::PerspectiveX ( Angle< T xfov,
T  aspect,
T  z_near,
T  z_far 
)
static

Constructs a perspective projection matrix.

Creates a new perspective matrix from x-axis xfov angle, x/y aspect ratio and z-axis z_near and z_far planes

Examples:
standalone/001_shape2dot.cpp.
template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::PerspectiveY ( Angle< T yfov,
T  aspect,
T  z_near,
T  z_far 
)
static

Constructs a perspective projection matrix.

Creates a new perspective matrix from y-axis yfov angle, x/y aspect ratio and z-axis z_near and z_far planes

template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::Pitch ( Angle< T angle)
static

Constructs a X-axis rotation (Pitch/Elevation) matrix.

The initial heading is the negative Z-axis, y_top is the Y-axis, x_right is X-axis. Positive angle values do counter-clockwise rotation (looking up), negative angles cause clockwise changes in pitch (looking down).

template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::Roll ( Angle< T angle)
static

Constructs a Z-axis rotation (Bank/Roll) matrix.

The initial position is that y_top is the Y-axis, heading in the negative Z-axis direction, x_right is X-axis. Positive angle values do counter-clockwise banking, negative angles do clockwise banking.

Vector<T, Cols> oglplus::Matrix< T, Rows, Cols >::Row ( std::size_t  i) const
inherited

Returns the i-th row of this matrix.

Precondition
(i < Rows)
template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::ScreenStretch ( T  x_left,
T  x_right,
T  y_bottom,
T  y_top 
)
static

Constructs a matrix for stretching NDCs after projection.

ScreenStretch constructs a matrix that can be used to stretch the normalized device coordinates after projection is applied.

template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::ScreenTile ( unsigned  x,
unsigned  y,
unsigned  nx,
unsigned  ny 
)
static

Constructs a matrix for stretching NDCs after projection.

ScreenTile constructs a matrix, that divides the screen into rectangular tiles with the specified divisions and stretches the normalized device coordinates to show the specified tile.

Precondition
(x >= 0) && (nx > 0) && (y >= 0) && (ny >= 0)
void oglplus::Matrix< T, Rows, Cols >::Set ( std::size_t  i,
std::size_t  j,
v 
)
inherited

Sets the value of the element at position i, j.

Precondition
(i < Rows) && (j < Cols)
Examples:
oglplus/021_translucent_arrow.cpp, oglplus/022_blender_mesh.cpp, oglplus/028_monkeycraft.cpp, oglplus/031_fog.cpp, and oglplus/032_object_tracking.cpp.
template<typename T>
static CameraMatrix oglplus::CameraMatrix< T >::Yaw ( Angle< T angle)
static

Constructs a Y-axis rotation (Heading/Yaw) matrix.

The initial heading is the negative Z-axix, y_top is the Y-axis, x_right is X-axis. Positive angle values do counter-clockwise rotation, negative angles cause clockwise changes in heading.


The documentation for this class was generated from the following file:
  • /home/chochlik/devel/oglplus/include/oglplus/math/matrix.hpp

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).