Panda3D
|
This is a 4-by-4 transform matrix. More...
Classes | |
class | CRow |
class | Row |
Public Member Functions | |
Mat4D () | |
Mat4D (Mat3D const upper3) | |
Mat4D (Mat4D const other) | |
Mat4D (double e00, double e01, double e02, double e03, double e10, double e11, double e12, double e13, double e20, double e21, double e22, double e23, double e30, double e31, double e32, double e33) | |
Mat4D (Mat3D const upper3, VBase3D const trans) | |
unsigned int | addHash (unsigned int hash) |
Adds the vector into the running hash. | |
unsigned int | addHash (unsigned int hash, double threshold) |
Adds the vector into the running hash. | |
bool | almostEqual (Mat4D const other) |
Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type. | |
bool | almostEqual (Mat4D const other, double threshold) |
Returns true if two matrices are memberwise equal within a specified tolerance. | |
begin () | |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style. | |
begin () | |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style. | |
int | compareTo (Mat4D const other) |
This flavor of compare_to uses a default threshold value based on the numeric type. | |
int | compareTo (Mat4D const other, double threshold) |
Sorts matrices lexicographically, componentwise. | |
end () | |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style. | |
end () | |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style. | |
fill (double fill_value) | |
Sets each element of the matrix to the indicated fill_value. | |
double | getCell (int row, int col) |
Returns a particular element of the matrix. | |
VBase4D | getCol (int col) |
Retrieves the indicated column of the matrix as a 4-component vector. | |
VBase3D | getCol3 (int col) |
Retrieves the indicated column of the matrix as a 3-component vector, ignoring the last row. | |
list | getCols () |
getData () | |
Returns the address of the first of the nine data elements in the matrix. | |
unsigned int | getHash () |
Returns a suitable hash for phash_map. | |
unsigned int | getHash (double threshold) |
Returns a suitable hash for phash_map. | |
int | getNumComponents () |
Returns the number of elements in the matrix, 16. | |
getRow (VBase4D result_vec, int row) | |
VBase4D | getRow (int row) |
Retrieves the indicated row of the matrix as a 4-component vector. | |
getRow3 (VBase3D result_vec, int row) | |
VBase3D | getRow3 (int row) |
Retrieves the row column of the matrix as a 3-component vector, ignoring the last column. | |
list | getRow3s () |
list | getRows () |
Mat3D | getUpper3 () |
Retrieves the upper 3x3 submatrix. | |
bool | invertAffineFrom (Mat4D const other) |
Performs an invert of the indicated matrix, storing the result in this matrix. | |
bool | invertFrom (Mat4D const other) |
Computes the inverse of the other matrix, and stores the result in this matrix. | |
bool | invertInPlace () |
Inverts the current matrix. | |
bool | isNan () |
Returns true if any component of the matrix is not-a-number, false otherwise. | |
multiply (Mat4D const other1, Mat4D const other2) | |
operator new (unsigned int size) | |
bool | operator!= (Mat4D const other) |
operator() (int row, int col) | |
double | operator() (int row, int col) |
Mat4D | operator* (double scalar) |
Mat4D | operator* (Mat4D const other) |
Mat4D | operator*= (double scalar) |
Mat4D | operator*= (Mat4D const other) |
Mat4D | operator+= (Mat4D const other) |
Performs a memberwise addition between two matrices. | |
Mat4D | operator-= (Mat4D const other) |
Performs a memberwise addition between two matrices. | |
Mat4D | operator/ (double scalar) |
Mat4D | operator/= (double scalar) |
bool | operator< (Mat4D const other) |
This performs a lexicographical comparison. | |
Mat4D | operator= (double fill_value) |
Mat4D | operator= (Mat4D const other) |
bool | operator== (Mat4D const other) |
CRow | operator[] (int i) |
Row | operator[] (int i) |
output (ostream out) | |
pythonRepr (ostream out, string class_name) | |
PyObject | reduce (PyObject self) |
This special Python method is implement to provide support for the pickle module. | |
set (double e00, double e01, double e02, double e03, double e10, double e11, double e12, double e13, double e20, double e21, double e22, double e23, double e30, double e31, double e32, double e33) | |
setCell (int row, int col, double value) | |
Changes a particular element of the matrix. | |
setCol (int col, VBase3D const v) | |
Replaces the indicated column of the matrix with the indicated 3-component vector, ignoring the last row. | |
setCol (int col, VBase4D const v) | |
Replaces the indicated column of the matrix. | |
setRotateMat (double angle, VBase3D const axis, CoordinateSystem cs) | |
Sets mat to a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. | |
setRotateMat (double angle, VBase3D const axis) | |
Sets mat to a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. | |
setRotateMatNormaxis (double angle, VBase3D const axis) | |
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. | |
setRotateMatNormaxis (double angle, VBase3D const axis, CoordinateSystem cs) | |
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. | |
setRow (int row, VBase3D const v) | |
Replaces the indicated row of the matrix with the indicated 3-component vector, ignoring the last column. | |
setRow (int row, VBase4D const v) | |
Replaces the indicated row of the matrix. | |
setScaleMat (VBase3D const scale) | |
Fills mat with a matrix that applies the indicated scale in each of the three axes. | |
setScaleShearMat (VBase3D const scale, VBase3D const shear, CoordinateSystem cs) | |
Fills mat with a matrix that applies the indicated scale and shear. | |
setScaleShearMat (VBase3D const scale, VBase3D const shear) | |
Fills mat with a matrix that applies the indicated scale and shear. | |
setShearMat (VBase3D const shear) | |
Fills mat with a matrix that applies the indicated shear in each of the three planes. | |
setShearMat (VBase3D const shear, CoordinateSystem cs) | |
Fills mat with a matrix that applies the indicated shear in each of the three planes. | |
setTranslateMat (VBase3D const trans) | |
Fills mat with a matrix that applies the indicated translation. | |
setUpper3 (Mat3D const upper3) | |
Sets the upper 3x3 submatrix. | |
transposeFrom (Mat4D const other) | |
transposeInPlace () | |
write (ostream out) | |
write (ostream out, int indent_level) | |
VBase4D | xform (VBase4D const v) |
4-component vector or point times matrix. | |
VBase3D | xformPoint (VBase3D const v) |
The matrix transforms a 3-component point (including translation component) and returns the result. | |
VBase3D | xformVec (VBase3D const v) |
The matrix transforms a 3-component vector (without translation component) and returns the result. | |
VBase3D | xformVecGeneral (VBase3D const v) |
The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation. | |
Static Public Member Functions | |
static Mat4D const | convertMat (CoordinateSystem from, CoordinateSystem to) |
Returns a matrix that transforms from the indicated coordinate system to the indicated coordinate system. | |
static TypeHandle | getClassType () |
static Mat4D const | identMat () |
Returns an identity matrix. | |
static Mat4D const | onesMat () |
Returns an matrix filled with ones. | |
static Mat4D | rotateMat (double angle, VBase3D const axis) |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. | |
static Mat4D | rotateMat (double angle, VBase3D const axis, CoordinateSystem cs) |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. | |
static Mat4D | rotateMatNormaxis (double angle, VBase3D const axis, CoordinateSystem cs) |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. | |
static Mat4D | rotateMatNormaxis (double angle, VBase3D const axis) |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. | |
static Mat4D | scaleMat (VBase3D const scale) |
Returns a matrix that applies the indicated scale in each of the three axes. | |
static Mat4D | scaleMat (double scale) |
Returns a matrix that applies the indicated uniform scale. | |
static Mat4D | scaleMat (double sx, double sy, double sz) |
Returns a matrix that applies the indicated scale in each of the three axes. | |
static Mat4D | scaleShearMat (VBase3D const scale, VBase3D const shear, CoordinateSystem cs) |
Returns a matrix that applies the indicated scale and shear. | |
static Mat4D | scaleShearMat (VBase3D const scale, VBase3D const shear) |
Returns a matrix that applies the indicated scale and shear. | |
static Mat4D | scaleShearMat (double sx, double sy, double sz, double shxy, double shxz, double shyz, CoordinateSystem cs) |
Returns a matrix that applies the indicated scale and shear. | |
static Mat4D | scaleShearMat (double sx, double sy, double sz, double shxy, double shxz, double shyz) |
Returns a matrix that applies the indicated scale and shear. | |
static Mat4D | shearMat (VBase3D const shear) |
Returns a matrix that applies the indicated shear in each of the three planes. | |
static Mat4D | shearMat (double shxy, double shxz, double shyz, CoordinateSystem cs) |
Returns a matrix that applies the indicated shear in each of the three planes. | |
static Mat4D | shearMat (double shxy, double shxz, double shyz) |
Returns a matrix that applies the indicated shear in each of the three planes. | |
static Mat4D | shearMat (VBase3D const shear, CoordinateSystem cs) |
Returns a matrix that applies the indicated shear in each of the three planes. | |
static int | size () |
Returns 4: the number of rows of a LMatrix4. | |
static Mat4D | translateMat (VBase3D const trans) |
Returns a matrix that applies the indicated translation. | |
static Mat4D | translateMat (double tx, double ty, double tz) |
Returns a matrix that applies the indicated translation. | |
static Mat4D const | yToZUpMat () |
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system. | |
static Mat4D const | zerosMat () |
Returns an matrix filled with zeros. | |
static Mat4D const | zToYUpMat () |
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system. |
This is a 4-by-4 transform matrix.
Mat4D | ( | ) |
Mat4D | ( | double | e00, |
double | e01, | ||
double | e02, | ||
double | e03, | ||
double | e10, | ||
double | e11, | ||
double | e12, | ||
double | e13, | ||
double | e20, | ||
double | e21, | ||
double | e22, | ||
double | e23, | ||
double | e30, | ||
double | e31, | ||
double | e32, | ||
double | e33 | ||
) |
bool almostEqual | ( | Mat4D const | other | ) |
Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual | ( | Mat4D const | other, |
double | threshold | ||
) |
Returns true if two matrices are memberwise equal within a specified tolerance.
begin | ( | ) |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style.
begin | ( | ) |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style.
Sorts matrices lexicographically, componentwise.
Returns a number less than 0 if this matrix sorts before the other one, greater than zero if it sorts after, 0 if they are equivalent (within the indicated tolerance).
This flavor of compare_to uses a default threshold value based on the numeric type.
static Mat4D const convertMat | ( | CoordinateSystem | from, |
CoordinateSystem | to | ||
) | [static] |
Returns a matrix that transforms from the indicated coordinate system to the indicated coordinate system.
end | ( | ) |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style.
end | ( | ) |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style.
fill | ( | double | fill_value | ) |
Sets each element of the matrix to the indicated fill_value.
This is of questionable value, but is sometimes useful when initializing to zero.
static TypeHandle getClassType | ( | ) | [static] |
Retrieves the indicated column of the matrix as a 3-component vector, ignoring the last row.
list getCols | ( | ) |
getData | ( | ) |
Returns the address of the first of the nine data elements in the matrix.
The remaining elements occupy the next eight positions in row-major order.
unsigned int getHash | ( | ) |
Returns a suitable hash for phash_map.
unsigned int getHash | ( | double | threshold | ) |
Returns a suitable hash for phash_map.
int getNumComponents | ( | ) |
Returns the number of elements in the matrix, 16.
Retrieves the row column of the matrix as a 3-component vector, ignoring the last column.
list getRow3s | ( | ) |
list getRows | ( | ) |
Mat3D getUpper3 | ( | ) |
Retrieves the upper 3x3 submatrix.
static Mat4D const identMat | ( | ) | [static] |
Returns an identity matrix.
This function definition must appear first, since some inline functions below take advantage of it.
bool invertAffineFrom | ( | Mat4D const | other | ) |
Performs an invert of the indicated matrix, storing the result in this matrix.
The calculation is only correct of the other matrix represents an affine transform.
The other matrix must be a different object than this matrix. However, if you need to invert a matrix in place, see invert_in_place.
The return value is true if the matrix was successfully inverted, false if the was a singularity. bugbug: we could optimize this for rotation/scale/translation matrices (transpose upper 3x3 and take negative of translation component)
bool invertFrom | ( | Mat4D const | other | ) |
Computes the inverse of the other matrix, and stores the result in this matrix.
This is a fully general operation and makes no assumptions about the type of transform represented by the matrix.
The other matrix must be a different object than this matrix. However, if you need to invert a matrix in place, see invert_in_place.
The return value is true if the matrix was successfully inverted, false if the was a singularity.
bool invertInPlace | ( | ) |
Inverts the current matrix.
Returns true if the inverse is successful, false if the matrix was singular.
bool isNan | ( | ) |
Returns true if any component of the matrix is not-a-number, false otherwise.
static Mat4D const onesMat | ( | ) | [static] |
Returns an matrix filled with ones.
operator new | ( | unsigned int | size | ) |
bool operator!= | ( | Mat4D const | other | ) |
Mat4D operator* | ( | double | scalar | ) |
Mat4D operator*= | ( | double | scalar | ) |
Mat4D operator/ | ( | double | scalar | ) |
Mat4D operator/= | ( | double | scalar | ) |
bool operator< | ( | Mat4D const | other | ) |
This performs a lexicographical comparison.
It's of questionable mathematical meaning, but sometimes has a practical purpose for sorting unique vectors, especially in an STL container. Also see compare_to().
Mat4D operator= | ( | double | fill_value | ) |
bool operator== | ( | Mat4D const | other | ) |
output | ( | ostream | out | ) |
pythonRepr | ( | ostream | out, |
string | class_name | ||
) |
PyObject reduce | ( | PyObject | self | ) |
This special Python method is implement to provide support for the pickle module.
static Mat4D rotateMat | ( | double | angle, |
VBase3D const | axis, | ||
CoordinateSystem | cs | ||
) | [static] |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
Assumes axis has been prenormalized.
static Mat4D rotateMatNormaxis | ( | double | angle, |
VBase3D const | axis, | ||
CoordinateSystem | cs | ||
) | [static] |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
Assumes axis has been prenormalized.
Returns a matrix that applies the indicated scale in each of the three axes.
static Mat4D scaleMat | ( | double | scale | ) | [static] |
Returns a matrix that applies the indicated uniform scale.
static Mat4D scaleMat | ( | double | sx, |
double | sy, | ||
double | sz | ||
) | [static] |
Returns a matrix that applies the indicated scale in each of the three axes.
static Mat4D scaleShearMat | ( | VBase3D const | scale, |
VBase3D const | shear, | ||
CoordinateSystem | cs | ||
) | [static] |
Returns a matrix that applies the indicated scale and shear.
static Mat4D scaleShearMat | ( | double | sx, |
double | sy, | ||
double | sz, | ||
double | shxy, | ||
double | shxz, | ||
double | shyz, | ||
CoordinateSystem | cs | ||
) | [static] |
Returns a matrix that applies the indicated scale and shear.
static Mat4D scaleShearMat | ( | double | sx, |
double | sy, | ||
double | sz, | ||
double | shxy, | ||
double | shxz, | ||
double | shyz | ||
) | [static] |
Returns a matrix that applies the indicated scale and shear.
Returns a matrix that applies the indicated scale and shear.
set | ( | double | e00, |
double | e01, | ||
double | e02, | ||
double | e03, | ||
double | e10, | ||
double | e11, | ||
double | e12, | ||
double | e13, | ||
double | e20, | ||
double | e21, | ||
double | e22, | ||
double | e23, | ||
double | e30, | ||
double | e31, | ||
double | e32, | ||
double | e33 | ||
) |
Replaces the indicated column of the matrix with the indicated 3-component vector, ignoring the last row.
setRotateMat | ( | double | angle, |
VBase3D const | axis, | ||
CoordinateSystem | cs | ||
) |
Sets mat to a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
setRotateMat | ( | double | angle, |
VBase3D const | axis | ||
) |
Sets mat to a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
setRotateMatNormaxis | ( | double | angle, |
VBase3D const | axis, | ||
CoordinateSystem | cs | ||
) |
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
Assumes axis has been prenormalized.
setRotateMatNormaxis | ( | double | angle, |
VBase3D const | axis | ||
) |
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
Assumes axis has been prenormalized.
Replaces the indicated row of the matrix with the indicated 3-component vector, ignoring the last column.
setScaleMat | ( | VBase3D const | scale | ) |
Fills mat with a matrix that applies the indicated scale in each of the three axes.
Fills mat with a matrix that applies the indicated scale and shear.
setScaleShearMat | ( | VBase3D const | scale, |
VBase3D const | shear, | ||
CoordinateSystem | cs | ||
) |
Fills mat with a matrix that applies the indicated scale and shear.
setShearMat | ( | VBase3D const | shear, |
CoordinateSystem | cs | ||
) |
Fills mat with a matrix that applies the indicated shear in each of the three planes.
setShearMat | ( | VBase3D const | shear | ) |
Fills mat with a matrix that applies the indicated shear in each of the three planes.
setTranslateMat | ( | VBase3D const | trans | ) |
Fills mat with a matrix that applies the indicated translation.
setUpper3 | ( | Mat3D const | upper3 | ) |
Sets the upper 3x3 submatrix.
static Mat4D shearMat | ( | VBase3D const | shear, |
CoordinateSystem | cs | ||
) | [static] |
Returns a matrix that applies the indicated shear in each of the three planes.
static Mat4D shearMat | ( | double | shxy, |
double | shxz, | ||
double | shyz | ||
) | [static] |
Returns a matrix that applies the indicated shear in each of the three planes.
static Mat4D shearMat | ( | double | shxy, |
double | shxz, | ||
double | shyz, | ||
CoordinateSystem | cs | ||
) | [static] |
Returns a matrix that applies the indicated shear in each of the three planes.
Returns a matrix that applies the indicated shear in each of the three planes.
static int size | ( | ) | [static] |
Returns 4: the number of rows of a LMatrix4.
static Mat4D translateMat | ( | double | tx, |
double | ty, | ||
double | tz | ||
) | [static] |
Returns a matrix that applies the indicated translation.
Returns a matrix that applies the indicated translation.
transposeFrom | ( | Mat4D const | other | ) |
transposeInPlace | ( | ) |
write | ( | ostream | out | ) |
4-component vector or point times matrix.
This is a fully general operation.
The matrix transforms a 3-component point (including translation component) and returns the result.
This assumes the matrix is an affine transform.
The matrix transforms a 3-component vector (without translation component) and returns the result.
This assumes the matrix is an orthonormal transform.
The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation.
static Mat4D const yToZUpMat | ( | ) | [static] |
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.
static Mat4D const zerosMat | ( | ) | [static] |
Returns an matrix filled with zeros.
static Mat4D const zToYUpMat | ( | ) | [static] |
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.