Matrix4x4 Struct Reference

Represents a 4-by-4 real matrix. More...

#include <matrix4x4.h>

List of all members.

Public Member Functions

 Matrix4x4 ()
 Initializes all elements to zeroes.
 Matrix4x4 (float c)
 Initializes all elements to the given real number c.
 Matrix4x4 (float mat[4][4])
 Initializes each element to the corresponding element in the given 4-by-4 array m.
 Matrix4x4 (float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
 Initialize each element to the corresponding given elements.
float * operator[] (int i) const
 Return the pointer of the ith row.
Matrix4x4 operator+ (const Matrix4x4 &other) const
 Add the given matrix to this and return the result.
Matrix4x4operator+= (const Matrix4x4 &other)
 Add the given matrix to this and set this to the result.
Matrix4x4 operator- (const Matrix4x4 &other) const
 Subtract the given matrix from this and return the result.
Matrix4x4operator-= (const Matrix4x4 &other)
 Subtract the given matrix from this and set this to the result.
Point3 operator* (const Point3 &p) const
 Multiply the given point to this and return the result.
Vector3 operator* (const Vector3 &v) const
 Multiply the given vector to this and return the result.
Matrix4x4 operator* (const Matrix4x4 &other) const
 Multiply this and other and return the result.
Matrix4x4operator*= (const Matrix4x4 &other)
 Multiply this and other and set this to the result.
void get_column_major_array (float *result)
 Fill the given array with the elements of the matrices sorted in column-major order.
bool is_near (const Matrix4x4 &other, float threshold=EPSILON) const
 Check if each element of this is within threshould of the corresponding element of other.

Static Public Member Functions

static Matrix4x4 identity ()
 Return the identity matrix.
static Matrix4x4 translate (float x, float y, float z)
 Return the translation matrix.
static Matrix4x4 translate_x (float x)
 Return the translation matrix where the translation is along the x-axis.
static Matrix4x4 translate_y (float y)
 Return the translation matrix where the translation is along the y-axis.
static Matrix4x4 translate_z (float z)
 Return the translation matrix where the translation is along the z-axis.
static Matrix4x4 scale (float x, float y, float z)
 Return a scaling matrix.
static Matrix4x4 scale (float s)
 Return a scaling matrix where the scaling factors along all axes are equal to s.
static Matrix4x4 scale_x (float x)
 Return a scaling matrix with the scaling factor along the x-axis is equal to x, and the scaling factor along other axese are equal to 1.
static Matrix4x4 scale_y (float y)
 Return a scaling matrix with the scaling factor along the y-axis is equal to y, and the scaling factor along other axese are equal to 1.
static Matrix4x4 scale_z (float z)
 Return a scaling matrix with the scaling factor along the z-axis is equal to z, and the scaling factor along other axese are equal to 1.
static Matrix4x4 rotate (float degrees, Vector3 axis)
 Return a rotation matrix, specifying the rotation angle in degrees and the axis of rotation.
static Matrix4x4 rotate_x (float degrees)
 Return a rotation matrix, specifying the rotation angle in degrees and the axis of rotation is the x-axis.
static Matrix4x4 rotate_y (float degrees)
 Return a rotation matrix, specifying the rotation angle in degrees and the axis of rotation is the y-axis.
static Matrix4x4 rotate_z (float degrees)
 Return a rotation matrix, specifying the rotation angle in degrees and the axis of rotation is the z-axis.
static Matrix4x4 look_at (Point3 eye, Point3 at, Vector3 up)
 Return the matrix of the look-at transformation.
static Matrix4x4 orthographic_projection (float left, float right, float bottom, float top, float near=0, float far=1)
 Return the matrix of the orthographic projection.
static Matrix4x4 perspective_projection (float left, float right, float bottom, float top, float near, float far)
 Return the matrix of the perspective projection.
static Matrix4x4 perspective_projection (float fovy, float aspect, float near, float far)
 Return the matrix of the perspective projection.

Private Attributes

float m [4][4]
 The elements.


Detailed Description

Represents a 4-by-4 real matrix.

Constructor & Destructor Documentation

Matrix4x4::Matrix4x4 (  )  [inline]

Initializes all elements to zeroes.

Matrix4x4::Matrix4x4 ( float  c  )  [inline]

Initializes all elements to the given real number c.

Matrix4x4::Matrix4x4 ( float  mat[4][4]  )  [inline]

Initializes each element to the corresponding element in the given 4-by-4 array m.

Parameters:
mat a 4-by-4 array representing a 4-by-4 matrix. The array is in row-major order.

Matrix4x4::Matrix4x4 ( float  m00,
float  m01,
float  m02,
float  m03,
float  m10,
float  m11,
float  m12,
float  m13,
float  m20,
float  m21,
float  m22,
float  m23,
float  m30,
float  m31,
float  m32,
float  m33 
) [inline]

Initialize each element to the corresponding given elements.


Member Function Documentation

void Matrix4x4::get_column_major_array ( float *  result  )  [inline]

Fill the given array with the elements of the matrices sorted in column-major order.

static Matrix4x4 Matrix4x4::identity (  )  [static]

Return the identity matrix.

bool Matrix4x4::is_near ( const Matrix4x4 other,
float  threshold = EPSILON 
) const [inline]

Check if each element of this is within threshould of the corresponding element of other.

Use this for checking approximate equality.

static Matrix4x4 Matrix4x4::look_at ( Point3  eye,
Point3  at,
Vector3  up 
) [static]

Return the matrix of the look-at transformation.

Matrix4x4 Matrix4x4::operator* ( const Matrix4x4 other  )  const [inline]

Multiply this and other and return the result.

Vector3 Matrix4x4::operator* ( const Vector3 v  )  const

Multiply the given vector to this and return the result.

Point3 Matrix4x4::operator* ( const Point3 p  )  const

Multiply the given point to this and return the result.

Matrix4x4& Matrix4x4::operator*= ( const Matrix4x4 other  )  [inline]

Multiply this and other and set this to the result.

Matrix4x4 Matrix4x4::operator+ ( const Matrix4x4 other  )  const [inline]

Add the given matrix to this and return the result.

Matrix4x4& Matrix4x4::operator+= ( const Matrix4x4 other  )  [inline]

Add the given matrix to this and set this to the result.

Matrix4x4 Matrix4x4::operator- ( const Matrix4x4 other  )  const [inline]

Subtract the given matrix from this and return the result.

Matrix4x4& Matrix4x4::operator-= ( const Matrix4x4 other  )  [inline]

Subtract the given matrix from this and set this to the result.

float* Matrix4x4::operator[] ( int  i  )  const [inline]

Return the pointer of the ith row.

Row index starts at 0.

static Matrix4x4 Matrix4x4::orthographic_projection ( float  left,
float  right,
float  bottom,
float  top,
float  near = 0,
float  far = 1 
) [static]

Return the matrix of the orthographic projection.

static Matrix4x4 Matrix4x4::perspective_projection ( float  fovy,
float  aspect,
float  near,
float  far 
) [static]

Return the matrix of the perspective projection.

static Matrix4x4 Matrix4x4::perspective_projection ( float  left,
float  right,
float  bottom,
float  top,
float  near,
float  far 
) [static]

Return the matrix of the perspective projection.

static Matrix4x4 Matrix4x4::rotate ( float  degrees,
Vector3  axis 
) [static]

Return a rotation matrix, specifying the rotation angle in degrees and the axis of rotation.

static Matrix4x4 Matrix4x4::rotate_x ( float  degrees  )  [static]

Return a rotation matrix, specifying the rotation angle in degrees and the axis of rotation is the x-axis.

static Matrix4x4 Matrix4x4::rotate_y ( float  degrees  )  [static]

Return a rotation matrix, specifying the rotation angle in degrees and the axis of rotation is the y-axis.

static Matrix4x4 Matrix4x4::rotate_z ( float  degrees  )  [static]

Return a rotation matrix, specifying the rotation angle in degrees and the axis of rotation is the z-axis.

static Matrix4x4 Matrix4x4::scale ( float  s  )  [static]

Return a scaling matrix where the scaling factors along all axes are equal to s.

static Matrix4x4 Matrix4x4::scale ( float  x,
float  y,
float  z 
) [static]

Return a scaling matrix.

static Matrix4x4 Matrix4x4::scale_x ( float  x  )  [static]

Return a scaling matrix with the scaling factor along the x-axis is equal to x, and the scaling factor along other axese are equal to 1.

static Matrix4x4 Matrix4x4::scale_y ( float  y  )  [static]

Return a scaling matrix with the scaling factor along the y-axis is equal to y, and the scaling factor along other axese are equal to 1.

static Matrix4x4 Matrix4x4::scale_z ( float  z  )  [static]

Return a scaling matrix with the scaling factor along the z-axis is equal to z, and the scaling factor along other axese are equal to 1.

static Matrix4x4 Matrix4x4::translate ( float  x,
float  y,
float  z 
) [static]

Return the translation matrix.

static Matrix4x4 Matrix4x4::translate_x ( float  x  )  [static]

Return the translation matrix where the translation is along the x-axis.

static Matrix4x4 Matrix4x4::translate_y ( float  y  )  [static]

Return the translation matrix where the translation is along the y-axis.

static Matrix4x4 Matrix4x4::translate_z ( float  z  )  [static]

Return the translation matrix where the translation is along the z-axis.


Member Data Documentation

float Matrix4x4::m[4][4] [private]

The elements.


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

Generated on Tue Sep 8 02:20:35 2009 for cglib by  doxygen 1.5.9