PrevUpHomeNext

Math utilities

Constants
Angles
Vectors
Matrices
Planes

#include <oglplus/math/constants.hpp>

This headers implements several functions returning math constants commonly used by the rest of OGLplus.

auto Pi(void); 1
auto TwoPi(void); 2
auto HalfPi(void); 3

1

Returns the value of π using a floating-point type with appropriate precision.

2

Returns the value of using a floating-point type with appropriate precision.

3

Returns the value of π/2 using a floating-point type with appropriate precision.

#include <oglplus/math/angle.hpp>

Angle is a lightweight class allowing more natural construction and usage of planar angle values. The storage requirements are the same as for the template parameter type T, but the Angle template gives the T type special meaning and implements a set of angle-related member and friend functions. There are also several associated free functions for creating new instances of Angle.

Definition
template <typename T>
class Angle
{
public:
Constructors
	Angle(void); 1
	Angle(const Angle&);

	template <typename U>
	Angle(const Angle<U>& other); 2

1

Constructs a zero angle.

2

Constructs an angle from angle with different underlying type.

Construction functions

These functions allow to construct instances of Angle from values in various units.

	static Angle Radians(T val_rad); 1
	static Angle Degrees(T val_deg); 2
	static Angle ArcSin(T x); 3
	static Angle ArcCos(T x);  4

1

Constructs a new angle from a value in radians.

2

Constructs a new angle from a value in degrees.

3

Constructs a new angle as the arc sine of the specified value.

4

Constructs a new angle as the arc sine of the specified value.

Angle value
	T Value(void) const; 1
	T ValueInDegrees(void) const; 2
	T ValueInRightAngles(void) const; 3
	T ValueInFullCircles(void) const; 4

1

Returns the value of the angle in radians.

2

Returns the value of the angle in degrees.

3

Returns the value of the angle in number of right angles.

4

Returns the value of the angle in number of full circles.

Comparison operators
	friend bool operator == (const Angle& a, const Angle& b); 1
	friend bool operator != (const Angle& a, const Angle& b);
	friend bool operator <= (const Angle& a, const Angle& b);
	friend bool operator <  (const Angle& a, const Angle& b);
	friend bool operator >= (const Angle& a, const Angle& b);
	friend bool operator >  (const Angle& a, const Angle& b);

1

Friend comparison operators.

Member operators

Operators modifying this instance of Angle.

	Angle& operator += (const Angle& a); 1
	Angle& operator -= (const Angle& a); 2
	Angle& operator *= (T c); 3
	Angle& operator /= (T c); 4

1

Adds angle a to this angle.

2

Subtracts angle a to this angle.

3

Multiplies this angle by a constant.

4

Divides this angle by a constant.

Friend operators

Friend operators returning new instance of Angle without modifying the arguments.

	friend Angle operator - (const Angle& a); 1
	friend Angle operator + (const Angle& a, const Angle& b); 2
	friend Angle operator - (const Angle& a, const Angle& b); 3
	friend Angle operator * (const Angle& a, T c); 4
	friend Angle operator * (T c, const Angle& a);
	friend Angle operator / (const Angle& a, T c); 5
	friend T operator / (const Angle& a, const Angle& b); 6

1

Negation.

2

Addition.

3

Subtraction.

4

Multiplication by a constant.

5

Division by a constant.

6

Ratio of two angles.

Member functions
	Angle& operator Add(const Angle& a); 1
	Angle& operator Subtract(const Angle& a); 2
	Angle& operator Multiply(T c); 3
	Angle& operator Divide(T c); 4

1

Adds a to this.

2

Subtracts a from this.

3

Multiplies this by c.

4

Divides this by c.

Friend functions
	friend Angle Negated(const Angle& a);
	friend Angle Added(const Angle& a, const Angle& b);
	friend Angle Subtracted(const Angle& a, const Angle& b);
	friend Angle Multiplied(const Angle& a, T c);
	friend Angle Divided(const Angle& a, T c);
	friend T Ratio(const Angle& a, const Angle& b); 1

1

Ratio of a to b.

Trigonometric functions
	T Sin(void) const; 1
	T Cos(void) const;
	T Tan(void) const;

	friend inline T Sin(const Angle& a); 2
	friend inline T Cos(const Angle& a);
	friend inline T Tan(const Angle& a);

1

Member trigonometric functions.

2

Friend trigonometric functions.

}; // class Angle
Other definitions
#ifdef GL_FLOAT
typedef Angle<GLfloat> Anglef;

Angle<GLfloat> Radians(GLfloat value); 1
Angle<GLfloat> Degrees(GLfloat value); 2
Angle<GLfloat> FullCircles(GLfloat value); 3
Angle<GLfloat> FullCircle(void); 4
Angle<GLfloat> RightAngles(GLfloat value);
Angle<GLfloat> RightAngle(void); 5

Angle<GLfloat> ArcSin(GLfloat x); 6
Angle<GLfloat> ArcCos(GLfloat x); 7
Angle<GLfloat> ArcTan(GLfloat x); 8

#endif // GL_FLOAT

template <typename T>
T SineWave(T t); 9
template <typename T>
T SineWave01(T t); 10

template <typename T>
T CosineWave(T t); 11
template <typename T>
T CosineWave01(T t); 12

1

Constructs a new angle from a value in radians.

2

Constructs a new angle from a value in degrees.

3

Constructs a new angle from a number of full turns.

4

Constructs a new angle with a value of radians (360 degrees).

5

Constructs a new angle with a value of π/2 radians (90 degrees).

6

Constructs a new angle as the arc-sine of the specified value.

7

Constructs a new angle as the arc-cosine of the specified value.

8

Constructs a new angle as the arc-tangent of the specified value.

9

Returns a value on a sine wave at the specified point. This function returns the value of sin(2π * t), i.e. integer values of t are the ends of the previous full sine wave and the begining of the next one.

10

Returns a value on a sine wave transformed to range <0, 1> This function returns the value of (sin(2π * t)+1)/2, i.e. integer values of t are the ends of the previous full sine wave and the begining of the next one.

11

Returns a value on a cosine wave at the specified point. This function returns the value of cos(2π * t), i.e. integer values of t are the ends of the previous full cosine wave and the begining of the next one.

12

Returns a value on a cosine wave transformed to range <0, 1> This function returns the value of (cos(2π * t)+1)/2, i.e. integer values of t are the ends of the previous full cosine wave and the begining of the next one.

#include <oglplus/math/vector.hpp>

The Vector class is used by OGLplus as the native template for (degenerate) 1-D and 2-D, 3-D and 4-D vector types. Values of Vector are mostly used to specify GLSL vec2, vec3, vec4 uniform values, but Vector is powerful enough to be used as a general-purpose N-dimensional space vector type in many other situations and is used ubiquitously in the oglplus examples.

The Vector class is a template with a pair of parameters; T and N denoting the underlying data-type and the dimension of the vector. The actual class is implemented as a set of template specializations which have many common member and friend functions, but there are also some differences between vectors of different dimensions.

Definition

The following unspecialized template is a synopsis of the interface common to all instantiations of Vector. The differences to the specializations are noted below.

template <typename T, size_t N>
class Vector
{
public:
Constructors
	Vector(const Vector&); 1
	Vector(void); 2
	Vector(const T (&v)[N]); 3
	Vector(const T* v, size_t n); 4
	Vector(const T* v, size_t n, T def); 5

	explicit Vector(T v); 6

	template <typename ... P>
	Vector(P ... p);  7

	template <typename U, size_t M>
	Vector(const Vector<U, M>& v) 8

	template <typename U, size_t M, typename ... P>
	Vector(const Vector<U, M>& v, P ... p);  9


	struct Unit_ { }; 10
	Vector(Unit_, size_t i); 11
	static Vector Unit(size_t i); 12

	explicit Vector(const Matrix<T, 1, N>& matrix); 13
	explicit Vector(const Matrix<T, N, 1>& matrix); 14

1

Vectors are copy-constructible.

2

Constructs a vector with all components initialized to zero.

3

Construction from a const C-array of T with known size.

4

Construction from a pointer to data and number of elements. The memory pointed-to by v must hold at least n valid instances of type T and n must be greater or equal to N - the dimension of the vector.

5

Construction from a pointer to data, number of elements and a default. The first n coordinates of the resulting vector are initialized by the first n values from the memory pointed-to by v. If n is less than N, then the remaining values are initialized to def. The memory pointed-to by v must hold at least n valid instances of type T.

6

Constructs a vector having all coordinates initialized to the specified value v.

7

Constructs a vector having its components initialized by the values p from the parameter pack. Available only if the number of arguments in the pack equals N and all types in P are convertible to T.

8

Truncation of a vector of higher or equal dimension possibly with a different underlying type. The resulting Vector has the same coordinates as the first N coordinates of the vector v passed as argument converted to T.

9

Construction from a vector of smaller dimension and a pack of values. The resulting vector has the first M components initialized from the vector m and the remaining N-M values from the pack p. This constructor is available only if M<N and the number of arguments in the pack equals N-M and all types in P are convertible to T.

10

Helper structure for dispatching the following constructor.

11

Constructs a vector with all components set to zero except for the ith coordinate, which is set to one. The value of i must be less than N.

12

Returns a vector with all components set to zero except for the ith coordinate, which is set to one. Equal to calling Vector(Vector::Unit_(), i). The value of i must be less than N.

13

Construction from a single row Matrix.

14

Construction from a single column Matrix.

Access to named coordinates and subvectors
	T x(void) const; 1
	T y(void) const; 2
	T z(void) const; 3
	T w(void) const; 4

	Vector<T, 2> xy(void) const; 5
	Vector<T, 3> xyz(void) const; 6

1

Returns the 0th component of the vector. This function is available in all specializations of Vector.

2

Returns the 1st component of the vector. This function is available only if N >= 2.

3

Returns the 2nd component of the vector. This function is available only if N >= 3.

4

Returns the 3rd component of the vector. This function is available only if N >= 4.

5

Returns a subvector with the first two components. This function is available only if N >= 2.

6

Returns a subvector with the first three components. This function is available only if N >= 3.

Member operators

Member operators modifying this.

	Vector& operator += (const Vector& a);
	Vector& operator -= (const Vector& a);
	Vector& operator *= (T c);
	Vector& operator *= (const Vector& a); 1
	Vector& operator /= (T c);

1

Per-component multiplication.

Friend operators

Friend operators returning new vectors without modifying the arguments.

	friend Vector operator == (const Vector& a, const Vector& b);
	friend Vector operator != (const Vector& a, const Vector& b);
	friend Vector operator + (const Vector& a);
	friend Vector operator - (const Vector& a);
	friend Vector operator + (const Vector& a, const Vector& b);
	friend Vector operator - (const Vector& a, const Vector& b);
	friend Vector operator * (const Vector& a, T c);
	friend Vector operator * (T c, const Vector& a);
	friend Vector operator / (const Vector& a, T c);

	template <size_t Cols>
	friend Vector<T, Cols> operator * (const Vector& v, const Matrix<T, N, Cols>& m); 1
	template <size_t Rows>
	friend Vector<T, Rows> operator * (const Matrix<T, Rows, N>& m, const Vector& v); 2

1

Vector × Matrix multiplication.

2

Matrix × Vector multiplication.

Member functions
	Vector& operator Add(const Vector& a); 1
	Vector& operator Subtract(const Vector& a); 2
	Vector& operator Multiply(T c); 3
	Vector& operator Divide(T c); 4

1

Adds a to this.

2

Subtracts a from this.

3

Multiplies this by c.

4

Divides this by c.

Friend functions
	friend bool Equal(const Vector& a, const Vector& b);

	friend Vector Negated(const Vector& a);
	friend Vector Added(const Vector& a, const Vector& b);
	friend Vector Subtracted(const Vector& a, const Vector& b);
	friend Vector Multiplied(const Vector& a, T c);
	friend Vector Divided(const Vector& a, T c);

	friend T Dot(const Vector& a, const Vector& b); 1
	friend T Length(const Vector& a); 2
	friend T Distance(const Vector& a, const Vector& b); 3

	friend Vector Normalized(Vector a); 4

1

Dot product of two vectors.

2

The length (magnitude) of a vector.

3

The distance between two vectors.

4

Returns a normalized vector pointing in the same direction as the vector passed as argument.

}; // class Vector
Special friend functions
template <typename T>
Vector<T, 2> Perpendicular(const Vector<T, 2>& a); 1

template <typename T>
Vector<T, 3> Cross(const Vector<T, 3>& a, const Vector<T, 3>& b); 2

1

Returns a vector perpendicular to the given vector. Available only for 2-dimensional vectors.

2

Returns a vector perpendicular to the given two vectors. Available only for 3-dimensional vectors.

Typedefs

This header also defines several 1 to 4-dimensional Vector typedefs for convenience.

#ifdef GL_INT
typedef Vector<GLint, 1> Vec1i; 1
typedef Vector<GLint, 2> Vec2i;
typedef Vector<GLint, 3> Vec3i;
typedef Vector<GLint, 4> Vec4i;
#endif

#ifdef GL_FLOAT
typedef Vector<GLfloat, 1> Vec1f; 2
typedef Vector<GLfloat, 2> Vec2f;
typedef Vector<GLfloat, 3> Vec3f;
typedef Vector<GLfloat, 4> Vec4f;
#endif

#ifdef GL_DOUBLE
typedef Vector<GLdouble, 1> Vec1d; 3
typedef Vector<GLdouble, 2> Vec2d;
typedef Vector<GLdouble, 3> Vec3d;
typedef Vector<GLdouble, 4> Vec4d;
#endif

1

Vectors with signed integer components.

2

Vectors with floating-point number components.

3

Vectors with double precision floating-point components.

#include <oglplus/math/matrix.hpp>

Definition
template <typename T, size_t Rows, size_t Cols>
class Matrix
{
public:
Constructors
	Matrix(const Matrix&); 1
	Matrix(void); 2

	explicit Matrix(const T (&data)[Rows*Cols]); 3
	Matrix(const T* data, size_t n); 4

	template <typename U, size_t R, size_t C>
	explicit Matrix(const Matrix<U, R, C>& other); 5

	template <typename ... P>
	explicit Matrix(P ... p); 6

	template <typename ... C>
	explicit Matrix(const Vector<T, C> ... row); 7

1

Matrices are copy-constructible

2

Constructs an identity matrix.

3

Construction from a const C-array of T with known size.

4

Construction from a pointer to data and number of elements. The memory pointed-to by v must hold at least n valid instances of type T and n must be greater or equal to Rows*Cols - the dimension of the vector.

5

Construction from a Matrix with different dimensions and possibly different underlying data type. This constructor is available only if U is convertible to T, R>=Rows and C>=Cols.

6

Construction from a pack of values. This constructor is available only if the number of arguments in p is equal to Rows*Cols.

7

Construction from a pack of instances of Vector. This constructor is only available if the number of vectors specified is equal to the number of Rows and each vector has exactly Cols components.

Operators
	friend bool operator == (const Matrix& a, const Matrix& b); 1
	friend bool operator != (const Matrix& a, const Matrix& b); 2

1

Equality comparison.

2

Inequality comparison.

Member functions
	void Fill(T value); 1
	const T* Data(void) const; 2
	size_t Size(void) const; 3

	T At(size_t i, size_t j) const; 4
	void Set(size_t i, size_t j, T v); 5

	Vector<T, Cols> Row(size_t i) const; 6
	Vector<T, Rows> Col(size_t j) const; 7

	template <size_t I, size_t J, size_t R, size_t C>
	Matrix<T, R, C> Submatrix(void) const 8

1

Fills all elements of the Matrix with the specified value.

2

Returns a pointer to the matrix elements in row major order.

3

Returns the number of elements of the matrix.

4

Returns the value at the position specified by i and j.

5

Sets the value of the element at the position specified by i and j.

6

Returns the ith row vector of this matrix.

7

Returns the jth column vector of this matrix.

8

Returns a submatrix of this matrix with R rows and C columns starting from row I and column J. Note, that the following must be true: Rows-I>=R and Cols-J>=C.

Friend functions
	friend const T* Data(const Matrix& matrix); 1
	friend size_t Size(const Matrix& matrix); 2
	friend size_t Rows(const Matrix& matrix); 3
	friend size_t Cols(const Matrix& matrix); 4

	friend bool Equal(const Matrix& a, const Matrix& b); 5
	friend Matrix Negated(const Matrix& a); 6

	friend Matrix Added(const Matrix& a, const Matrix& b); 7
	friend Matrix Subtracted(const Matrix& a, const Matrix& b); 8
	friend Matrix Multiplied(const Matrix& a, T c); 9

	template <size_t N>
	friend Matrix Multiplied(
		const Matrix<T, Rows, N>& a,
		const Matrix<T, N, Cols>& b
	); 10

	friend Matrix Transposed(const Matrix<T, Cols, Rows>& a); 11

	friend Matrix Inverse(Matrix m); 12

	template <size_t I, size_t J, size_t R, size_t C>
	friend Matrix<T, R, C> Submatrix(const Matrix& a) const; 13
	friend Matrix<T, 2, 2> Sub2x2(const Matrix& a); 14
	friend Matrix<T, 3, 3> Sub3x3(const Matrix& a); 15

1

Returns a pointer to the matrix elements in row major order.

2

Returns the number of elements of the matrix.

3

Returns the number of rows of the matrix.

4

Returns the number of columns of the matrix.

5

Returns true if the two matrices a and b are equal.

6

Returns a copy of the matrix passed as argument with all elements negated.

7

Matrix addition.

8

Matrix subtraction.

9

Matrix-by-constant multiplication.

10

Matrix-by-matrix multiplication.

11

Returns a transposed copy of the matrix specified as the argument.

12

Returns the inverse for the specified matrix m.

13

Returns a submatrix of the specified matrix with R rows and C columns starting from row I and column J. Note, that the following must be true: Rows-I>=R and Cols-J>=C.

14

Returns a 2x2 submatrix of the specified matrix.

15

Returns a 3x3 submatrix of the specified matrix.

Row operations
	friend void RowSwap(Matrix& m, size_t a, size_t b); 1
	friend void RowMultiply(Matrix& m, size_t i, T c); 2
	friend void RowAdd(Matrix& m, size_t a, size_t b, T c); 3

	template <size_t C>
	friend bool Gauss(Matrix& a, Matrix<T, Rows, C>& b); 4

	template <std::size_t C>
	friend bool GaussJordan(Matrix& a, Matrix<T, Rows, C>& b); 5

1

Swaps the ath with bth row of the specified matrix.

2

Multiplies the ith row of the specified matrix m by the constant c.

3

Adds the row b multiplied by the constant c to the row a, of the specified matrix m.

4

Performs Gaussian elimination on the specified pair of matrices. Returns true if the elimination was succesfully completed.

5

Performs Gauss-Jordan elimination on the specified pair of matrices. Returns true if the elimination was succesfully completed.

}; // class Matrix
Matrix typedefs
#ifdef GL_FLOAT
typedef Matrix<GLfloat, 2, 2> Mat2f; 1
typedef Matrix<GLfloat, 2, 3> Mat2x3f;
typedef Matrix<GLfloat, 2, 4> Mat2x4f;
typedef Matrix<GLfloat, 3, 2> Mat3x2f;
typedef Matrix<GLfloat, 3, 3> Mat3f;
typedef Matrix<GLfloat, 3, 4> Mat3x4f;
typedef Matrix<GLfloat, 4, 2> Mat4x2f;
typedef Matrix<GLfloat, 4, 3> Mat4x3f;
typedef Matrix<GLfloat, 4, 4> Mat4f;
#endif

#ifdef GL_DOUBLE
typedef Matrix<GLdouble, 2, 2> Mat2d; 2
typedef Matrix<GLdouble, 2, 3> Mat2x3d;
typedef Matrix<GLdouble, 2, 4> Mat2x4d;
typedef Matrix<GLdouble, 3, 2> Mat3x2d;
typedef Matrix<GLdouble, 3, 3> Mat3d;
typedef Matrix<GLdouble, 3, 4> Mat3x4d;
typedef Matrix<GLdouble, 4, 2> Mat4x2d;
typedef Matrix<GLdouble, 4, 3> Mat4x3d;
typedef Matrix<GLdouble, 4, 4> Mat4d;
#endif

1

Floating-point matrices.

2

Double-precision floating-point matrices.

template <typename T>
class ModelMatrix
 : public Matrix<T, 4, 4>
{
public:
	ModelMatrix(const Matrix<T, 4, 4>& base); 1
	ModelMatrix(void); 2

	static ModelMatrix Translation(T dx, T dy, T dz); 3
	static ModelMatrix Translation(const Vector<T, 3>& dp);
	static ModelMatrix TranslationX(T dx);
	static ModelMatrix TranslationY(T dy);
	static ModelMatrix TranslationZ(T dz);

	static ModelMatrix Scale(T sx, T sy, T sz); 4

	static ModelMatrix Reflection(bool rx, bool ry, bool rz); 5

	static ModelMatrix RotationX(Angle<T> angle); 6
	static ModelMatrix RotationY(Angle<T> angle);
	static ModelMatrix RotationZ(Angle<T> angle);
	static ModelMatrix RotationA(const Vector<T, 3>& axis, Angle<T> angle); 7

}; // ModelMatrix

#ifdef GL_FLOAT
typedef ModelMatrix<GLfloat> ModelMatrixf;
#endif
#ifdef GL_DOUBLE
typedef ModelMatrix<GLdouble> ModelMatrixd;
#endif

1

Construction from a 4x4 Matrix.

2

Construction of an identity matrix.

3

Functions constructing translation matrices with the specified offsets along the X, Y and Z axes.

4

Function constructing scale matrix with the specified scale factors along the X, Y and Z axes.

5

Function constructing reflection matrix, with rx, ry and rz specifying whether the X, Y and Z axes should be reflected.

6

Functions constructing matrices for rotation by the specified angle along the X, Y and Z axes.

7

Function constructing matrix for rotation by the specified angle along the specified axis.

template <typename T>
class CameraMatrix
 : public Matrix<T, 4, 4>
{
public:
	CameraMatrix(const Matrix<T, 4, 4>& base);

	static CameraMatrix Perspective(
		T x_left,
		T x_right,
		T y_bottom,
		T y_top,
		T z_near,
		T z_far
	); 1
	static CameraMatrix PerspectiveX(Angle<T> xfov, T aspect, T z_near, T z_far); 2
	static CameraMatrix PerspectiveY(Angle<T> yfov, T aspect, T z_near, T z_far); 3

	static CameraMatrix Ortho(
		T x_left,
		T x_right,
		T y_bottom,
		T y_top,
		T z_near,
		T z_far
	); 4
	static CameraMatrix OrthoX(T width, T aspect, T z_near, T z_far); 5
	static CameraMatrix OrthoY(T height, T aspect, T z_near, T z_far); 6

	static CameraMatrix ScreenStretch(T x_left, T x_right, T y_bottom, T y_top); 7
	static CameraMatrix ScreenTile(unsigned x, unsigned y, unsigned nx, unsigned ny); 8

	static CameraMatrix LookingAt(
		const Vector<T, 3>& eye,
		const Vector<T, 3>& target
	); 9

	static CameraMatrix Orbiting(
		const Vector<T, 3>& target,
		T radius,
		Angle<T> azimuth,
		Angle<T> elevation
	); 10

	static CameraMatrix Pitch(Angle<T> angle); 11
	static CameraMatrix Yaw(Angle<T> angle); 12
	static CameraMatrix Roll(Angle<T> angle); 13

	Vector<T, 3> Position(void) const; 14
	Vector<T, 3> Direction(void) const;
}; // CameraMatrix

#ifdef GL_FLOAT
typedef CameraMatrix<GLfloat> CamMatrixf;
#endif
#ifdef GL_DOUBLE
typedef CameraMatrix<GLdouble> CamMatrixd;
#endif

1

Creates a new perspective projection matrix with specified parameters.

2

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

3

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

4

Creates an orthographic projection matrix with the specified parameters.

5

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

6

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

7

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

8

Constructs a matrix, that divides the screen into rectangular tiles with the specified numbers of divisions nx and ny and stretches the normalized device coordinates to show the specified tile.

9

Constructs a matrix for a camera placed at eye and looking at target positions.

10

Constructs a matrix for a camera orbiting the target position at the distance specified by radius, with the specified azimuth and elevation angles.

11

Constructs an X-axis rotation (Pitch/Elevation) matrix. The initial heading is the negative Z-axis, top is the Y-axis, right is the X-axis. Positive angle values do counter-clockwise rotation (looking up), negative angles cause clockwise changes in pitch (looking down).

12

Constructs a Y-axis rotation (Heading/Yaw) matrix. The initial heading is the negative Z-axis, top is the Y-axis, right is the X-axis. Positive angle values do counter-clockwise rotation (rotating left), negative values cause clockwise changes in heading (rotating right).

13

Constructs a Z-axis rotation (Bank/Roll) matrix. The initial position is that top is the Y-axis, heading in the negative Z-axis direction, right is the X-axis. Positive angle values do counter-clockwise banking (rolling left), negative values do clockwise banking (rolling right).

14

The position of and the direction in which the camera represented by this matrix points to.

#include <oglplus/math/plane.hpp>

template <typename T>
class Plane
{
public:

}; // class Plane

PrevUpHomeNext