Panda3D
|
This is a 4-by-4 transform matrix. More...
Classes | |
class | CRow |
class | Row |
Public Types | |
enum | { num_components = 16, is_int = 0 } |
Public Member Functions | |
__init__ () | |
__init__ (const LMatrix3f upper3) | |
__init__ (const LMatrix3f upper3, const LVecBase3f trans) | |
__init__ (const LMatrix4f other) | |
__init__ (const LVecBase4f, const LVecBase4f, const LVecBase4f, const LVecBase4f) | |
Constructs the matrix from four individual rows. More... | |
__init__ (const UnalignedLMatrix4f other) | |
__init__ (float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float) | |
object | __reduce__ () |
str | __repr__ () |
accumulate (const LMatrix4f other, float weight) | |
Computes (*this) += other * weight. More... | |
int | addHash (int hash) |
Adds the vector into the running hash. More... | |
int | addHash (int hash, float threshold) |
Adds the vector into the running hash. More... | |
bool | almostEqual (const LMatrix4f other) |
Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type. More... | |
bool | almostEqual (const LMatrix4f other, float threshold) |
Returns true if two matrices are memberwise equal within a specified tolerance. More... | |
begin () | |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style. More... | |
begin () | |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style. More... | |
int | compareTo (const LMatrix4f other) |
This flavor of compare_to uses a default threshold value based on the numeric type. More... | |
int | compareTo (const LMatrix4f other, float threshold) |
Sorts matrices lexicographically, componentwise. More... | |
componentwiseMult (const LMatrix4f other) | |
end () | |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style. More... | |
end () | |
Returns an iterator that may be used to traverse the elements of the matrix, STL-style. More... | |
fill (float fill_value) | |
Sets each element of the matrix to the indicated fill_value. More... | |
generateHash (ChecksumHashGenerator hashgen) | |
Adds the vector to the indicated hash generator. More... | |
generateHash (ChecksumHashGenerator hashgen, float scale) | |
Adds the vector to the indicated hash generator. More... | |
float | getCell (int row, int col) |
Returns a particular element of the matrix. More... | |
LVecBase4f | getCol (int col) |
Retrieves the indicated column of the matrix as a 4-component vector. More... | |
LVecBase3f | getCol3 (int col) |
Retrieves the indicated column of the matrix as a 3-component vector, ignoring the last row. More... | |
list | getCols () |
getData () | |
Returns the address of the first of the nine data elements in the matrix. More... | |
int | getHash () |
Returns a suitable hash for phash_map. More... | |
int | getHash (float threshold) |
Returns a suitable hash for phash_map. More... | |
int | getNumComponents () |
Returns the number of elements in the matrix, 16. More... | |
getRow (LVecBase4f result_vec, int row) | |
Stores the indicated row of the matrix as a 4-component vector. More... | |
LVecBase4f | getRow (int row) |
Retrieves the indicated row of the matrix as a 4-component vector. More... | |
getRow3 (LVecBase3f result_vec, int row) | |
Stores the row column of the matrix as a 3-component vector, ignoring the last column. More... | |
LVecBase3f | getRow3 (int row) |
Retrieves the row column of the matrix as a 3-component vector, ignoring the last column. More... | |
list | getRow3s () |
list | getRows () |
LMatrix3f | getUpper3 () |
Retrieves the upper 3x3 submatrix. More... | |
bool | invertAffineFrom (const LMatrix4f other) |
bool | invertFrom (const LMatrix4f other) |
Computes the inverse of the other matrix, and stores the result in this matrix. More... | |
bool | invertInPlace () |
Inverts the current matrix. More... | |
bool | isIdentity () |
Returns true if this is (close enough to) the identity matrix, false otherwise. More... | |
bool | isNan () |
Returns true if any component of the matrix is not-a-number, false otherwise. More... | |
multiply (const LMatrix4f other1, const LMatrix4f other2) | |
bool | operator != (const LMatrix4f other) |
LMatrix4f | operator * (const LMatrix4f other) |
LMatrix4f | operator * (float scalar) |
LMatrix4f | operator *= (const LMatrix4f other) |
LMatrix4f | operator *= (float scalar) |
LMatrix4f | operator -= (const LMatrix4f other) |
Performs a memberwise addition between two matrices. More... | |
LMatrix4f::Row | operator [] (int i) |
LMatrix4f::CRow | operator [] (int i) |
operator new (int size) | |
operator() (int row, int col) | |
float | operator() (int row, int col) |
LMatrix4f | operator+= (const LMatrix4f other) |
Performs a memberwise addition between two matrices. More... | |
LMatrix4f | operator/ (float scalar) |
LMatrix4f | operator/= (float scalar) |
bool | operator< (const LMatrix4f other) |
LMatrix4f | operator= (const LMatrix4f other) |
LMatrix4f | operator= (const UnalignedLMatrix4f other) |
LMatrix4f | operator= (float fill_value) |
bool | operator== (const LMatrix4f other) |
output (Ostream out) | |
readDatagram (DatagramIterator source) | |
Reads the matrix from the Datagram using get_stdfloat(). More... | |
readDatagramFixed (DatagramIterator scan) | |
Reads the matrix from the Datagram using get_float32() or get_float64(). More... | |
set (float e00, float e01, float e02, float e03, float e10, float e11, float e12, float e13, float e20, float e21, float e22, float e23, float e30, float e31, float e32, float e33) | |
setCell (int row, int col, float value) | |
Changes a particular element of the matrix. More... | |
setCol (int col, const LVecBase3f v) | |
Replaces the indicated column of the matrix with the indicated 3-component vector, ignoring the last row. More... | |
setCol (int col, const LVecBase4f v) | |
Replaces the indicated column of the matrix. More... | |
setRotateMat (float angle, const LVecBase3f axis, CoordinateSystem cs) | |
Sets mat to a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More... | |
setRotateMatNormaxis (float angle, const LVecBase3f axis, CoordinateSystem cs) | |
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More... | |
setRow (int row, const LVecBase3f v) | |
Replaces the indicated row of the matrix with the indicated 3-component vector, ignoring the last column. More... | |
setRow (int row, const LVecBase4f v) | |
Replaces the indicated row of the matrix. More... | |
setScaleMat (const LVecBase3f scale) | |
Fills mat with a matrix that applies the indicated scale in each of the three axes. More... | |
setScaleShearMat (const LVecBase3f scale, const LVecBase3f shear, CoordinateSystem cs) | |
Fills mat with a matrix that applies the indicated scale and shear. More... | |
setShearMat (const LVecBase3f shear, CoordinateSystem cs) | |
Fills mat with a matrix that applies the indicated shear in each of the three planes. More... | |
setTranslateMat (const LVecBase3f trans) | |
Fills mat with a matrix that applies the indicated translation. More... | |
setUpper3 (const LMatrix3f upper3) | |
transposeFrom (const LMatrix4f other) | |
transposeInPlace () | |
write (Ostream out, int indent_level) | |
writeDatagram (Datagram destination) | |
Writes the matrix to the Datagram using add_stdfloat(). More... | |
writeDatagramFixed (Datagram destination) | |
Writes the matrix to the Datagram using add_float32() or add_float64(), depending on the type of floats in the matrix, regardless of the setting of Datagram::set_stdfloat_double(). More... | |
LVecBase4f | xform (const LVecBase4f v) |
4-component vector or point times matrix. More... | |
xformInPlace (LVecBase4f v) | |
4-component vector or point times matrix. More... | |
LVecBase3f | xformPoint (const LVecBase3f v) |
The matrix transforms a 3-component point (including translation component) and returns the result. More... | |
LVecBase3f | xformPointGeneral (const LVecBase3f v) |
The matrix transforms a 3-component point (including translation component) and returns the result, as a fully general operation. More... | |
xformPointGeneralInPlace (LVecBase3f v) | |
The matrix transforms a 3-component point (including translation component), as a fully general operation. More... | |
xformPointInPlace (LVecBase3f v) | |
The matrix transforms a 3-component point (including translation component). More... | |
LVecBase3f | xformVec (const LVecBase3f v) |
The matrix transforms a 3-component vector (without translation component) and returns the result. More... | |
LVecBase3f | xformVecGeneral (const LVecBase3f v) |
The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation. More... | |
xformVecGeneralInPlace (LVecBase3f v) | |
The matrix transforms a 3-component vector (without translation component), as a fully general operation. More... | |
xformVecInPlace (LVecBase3f v) | |
The matrix transforms a 3-component vector (without translation component). More... | |
Static Public Member Functions | |
static const LMatrix4f | convertMat (CoordinateSystem from, CoordinateSystem to) |
Returns a matrix that transforms from the indicated coordinate system to the indicated coordinate system. More... | |
static TypeHandle | getClassType () |
static const LMatrix4f | identMat () |
Returns an identity matrix. More... | |
static const LMatrix4f | onesMat () |
Returns an matrix filled with ones. More... | |
static LMatrix4f | rotateMat (float angle, const LVecBase3f axis, CoordinateSystem cs) |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More... | |
static LMatrix4f | rotateMatNormaxis (float angle, const LVecBase3f axis, CoordinateSystem cs) |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More... | |
static LMatrix4f | scaleMat (const LVecBase3f scale) |
Returns a matrix that applies the indicated scale in each of the three axes. More... | |
static LMatrix4f | scaleMat (float scale) |
Returns a matrix that applies the indicated uniform scale. More... | |
static LMatrix4f | scaleMat (float sx, float sy, float sz) |
Returns a matrix that applies the indicated scale in each of the three axes. More... | |
static LMatrix4f | scaleShearMat (const LVecBase3f scale, const LVecBase3f shear, CoordinateSystem cs) |
Returns a matrix that applies the indicated scale and shear. More... | |
static LMatrix4f | scaleShearMat (float sx, float sy, float sz, float shxy, float shxz, float shyz, CoordinateSystem cs) |
Returns a matrix that applies the indicated scale and shear. More... | |
static LMatrix4f | shearMat (const LVecBase3f shear, CoordinateSystem cs) |
Returns a matrix that applies the indicated shear in each of the three planes. More... | |
static LMatrix4f | shearMat (float shxy, float shxz, float shyz, CoordinateSystem cs) |
Returns a matrix that applies the indicated shear in each of the three planes. More... | |
static int | size () |
Returns 4: the number of rows of a LMatrix4. More... | |
static LMatrix4f | translateMat (const LVecBase3f trans) |
Returns a matrix that applies the indicated translation. More... | |
static LMatrix4f | translateMat (float tx, float ty, float tz) |
Returns a matrix that applies the indicated translation. More... | |
static const LMatrix4f | yToZUpMat () |
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system. More... | |
static const LMatrix4f | zerosMat () |
Returns an matrix filled with zeros. More... | |
static const LMatrix4f | zToYUpMat () |
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system. More... | |
Public Attributes | |
LVecBase4f | cols [] |
LVecBase4f | rows [] |
This is a 4-by-4 transform matrix.
__init__ | ( | ) |
__init__ | ( | const LMatrix3f | upper3 | ) |
__init__ | ( | const LMatrix3f | upper3, |
const LVecBase3f | trans | ||
) |
__init__ | ( | const LMatrix4f | other | ) |
__init__ | ( | const | LVecBase4f, |
const | LVecBase4f, | ||
const | LVecBase4f, | ||
const | LVecBase4f | ||
) |
Constructs the matrix from four individual rows.
__init__ | ( | const UnalignedLMatrix4f | other | ) |
__init__ | ( | float | , |
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | |||
) |
object __reduce__ | ( | ) |
str __repr__ | ( | ) |
accumulate | ( | const LMatrix4f | other, |
float | weight | ||
) |
Computes (*this) += other * weight.
int addHash | ( | int | hash | ) |
Adds the vector into the running hash.
int addHash | ( | int | hash, |
float | threshold | ||
) |
Adds the vector into the running hash.
bool almostEqual | ( | const LMatrix4f | other | ) |
Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual | ( | const LMatrix4f | other, |
float | threshold | ||
) |
Returns true if two matrices are memberwise equal within a specified tolerance.
This is faster than the equivalence operator as this doesn't have to guarantee that it is transitive.
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 | ( | const LMatrix4f | other | ) |
This flavor of compare_to uses a default threshold value based on the numeric type.
int compareTo | ( | const LMatrix4f | other, |
float | threshold | ||
) |
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).
componentwiseMult | ( | const LMatrix4f | other | ) |
|
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 | ( | float | 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.
generateHash | ( | ChecksumHashGenerator | hashgen | ) |
Adds the vector to the indicated hash generator.
generateHash | ( | ChecksumHashGenerator | hashgen, |
float | scale | ||
) |
Adds the vector to the indicated hash generator.
float getCell | ( | int | row, |
int | col | ||
) |
Returns a particular element of the matrix.
|
static |
LVecBase4f getCol | ( | int | col | ) |
Retrieves the indicated column of the matrix as a 4-component vector.
LVecBase3f 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.
The remaining elements occupy the next eight positions in row-major order.
int getHash | ( | ) |
Returns a suitable hash for phash_map.
int getHash | ( | float | threshold | ) |
Returns a suitable hash for phash_map.
int getNumComponents | ( | ) |
Returns the number of elements in the matrix, 16.
getRow | ( | LVecBase4f | result_vec, |
int | row | ||
) |
Stores the indicated row of the matrix as a 4-component vector.
LVecBase4f getRow | ( | int | row | ) |
Retrieves the indicated row of the matrix as a 4-component vector.
getRow3 | ( | LVecBase3f | result_vec, |
int | row | ||
) |
Stores the row column of the matrix as a 3-component vector, ignoring the last column.
LVecBase3f getRow3 | ( | int | row | ) |
Retrieves the row column of the matrix as a 3-component vector, ignoring the last column.
list getRow3s | ( | ) |
list getRows | ( | ) |
LMatrix3f getUpper3 | ( | ) |
Retrieves the upper 3x3 submatrix.
|
static |
Returns an identity matrix.
This function definition must appear first, since some inline functions below take advantage of it.
bool invertAffineFrom | ( | const LMatrix4f | other | ) |
bool invertFrom | ( | const LMatrix4f | 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 isIdentity | ( | ) |
Returns true if this is (close enough to) the identity matrix, false otherwise.
bool isNan | ( | ) |
Returns true if any component of the matrix is not-a-number, false otherwise.
|
static |
Returns an matrix filled with ones.
bool operator != | ( | const LMatrix4f | other | ) |
LMatrix4f operator * | ( | float | scalar | ) |
LMatrix4f operator *= | ( | float | scalar | ) |
LMatrix4f::Row operator [] | ( | int | i | ) |
LMatrix4f::CRow operator [] | ( | int | i | ) |
operator new | ( | int | size | ) |
operator() | ( | int | row, |
int | col | ||
) |
float operator() | ( | int | row, |
int | col | ||
) |
LMatrix4f operator/ | ( | float | scalar | ) |
LMatrix4f operator/= | ( | float | scalar | ) |
bool operator< | ( | const LMatrix4f | other | ) |
LMatrix4f operator= | ( | const UnalignedLMatrix4f | other | ) |
LMatrix4f operator= | ( | float | fill_value | ) |
bool operator== | ( | const LMatrix4f | other | ) |
output | ( | Ostream | out | ) |
readDatagram | ( | DatagramIterator | source | ) |
Reads the matrix from the Datagram using get_stdfloat().
readDatagramFixed | ( | DatagramIterator | scan | ) |
Reads the matrix from the Datagram using get_float32() or get_float64().
See write_datagram_fixed().
|
static |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
|
static |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
Assumes axis has been prenormalized.
|
static |
Returns a matrix that applies the indicated scale in each of the three axes.
|
static |
Returns a matrix that applies the indicated uniform scale.
|
static |
Returns a matrix that applies the indicated scale in each of the three axes.
|
static |
Returns a matrix that applies the indicated scale and shear.
|
static |
Returns a matrix that applies the indicated scale and shear.
set | ( | float | e00, |
float | e01, | ||
float | e02, | ||
float | e03, | ||
float | e10, | ||
float | e11, | ||
float | e12, | ||
float | e13, | ||
float | e20, | ||
float | e21, | ||
float | e22, | ||
float | e23, | ||
float | e30, | ||
float | e31, | ||
float | e32, | ||
float | e33 | ||
) |
setCell | ( | int | row, |
int | col, | ||
float | value | ||
) |
Changes a particular element of the matrix.
setCol | ( | int | col, |
const LVecBase3f | v | ||
) |
Replaces the indicated column of the matrix with the indicated 3-component vector, ignoring the last row.
setCol | ( | int | col, |
const LVecBase4f | v | ||
) |
Replaces the indicated column of the matrix.
setRotateMat | ( | float | angle, |
const LVecBase3f | axis, | ||
CoordinateSystem | cs | ||
) |
Sets mat to a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
setRotateMatNormaxis | ( | float | angle, |
const LVecBase3f | 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.
setRow | ( | int | row, |
const LVecBase3f | v | ||
) |
Replaces the indicated row of the matrix with the indicated 3-component vector, ignoring the last column.
setRow | ( | int | row, |
const LVecBase4f | v | ||
) |
Replaces the indicated row of the matrix.
setScaleMat | ( | const LVecBase3f | scale | ) |
Fills mat with a matrix that applies the indicated scale in each of the three axes.
setScaleShearMat | ( | const LVecBase3f | scale, |
const LVecBase3f | shear, | ||
CoordinateSystem | cs | ||
) |
Fills mat with a matrix that applies the indicated scale and shear.
setShearMat | ( | const LVecBase3f | shear, |
CoordinateSystem | cs | ||
) |
Fills mat with a matrix that applies the indicated shear in each of the three planes.
setTranslateMat | ( | const LVecBase3f | trans | ) |
Fills mat with a matrix that applies the indicated translation.
setUpper3 | ( | const LMatrix3f | upper3 | ) |
|
static |
Returns a matrix that applies the indicated shear in each of the three planes.
|
static |
Returns a matrix that applies the indicated shear in each of the three planes.
|
static |
Returns 4: the number of rows of a LMatrix4.
|
static |
Returns a matrix that applies the indicated translation.
|
static |
Returns a matrix that applies the indicated translation.
transposeFrom | ( | const LMatrix4f | other | ) |
transposeInPlace | ( | ) |
write | ( | Ostream | out, |
int | indent_level | ||
) |
writeDatagram | ( | Datagram | destination | ) |
Writes the matrix to the Datagram using add_stdfloat().
This is appropriate when you want to write the matrix using the standard width setting, especially when you are writing a bam file.
writeDatagramFixed | ( | Datagram | destination | ) |
Writes the matrix to the Datagram using add_float32() or add_float64(), depending on the type of floats in the matrix, regardless of the setting of Datagram::set_stdfloat_double().
This is appropriate when you want to write a fixed-width value to the datagram, especially when you are not writing a bam file.
LVecBase4f xform | ( | const LVecBase4f | v | ) |
4-component vector or point times matrix.
This is a fully general operation.
xformInPlace | ( | LVecBase4f | v | ) |
4-component vector or point times matrix.
This is a fully general operation.
LVecBase3f xformPoint | ( | const LVecBase3f | v | ) |
The matrix transforms a 3-component point (including translation component) and returns the result.
This assumes the matrix is an affine transform.
LVecBase3f xformPointGeneral | ( | const LVecBase3f | v | ) |
The matrix transforms a 3-component point (including translation component) and returns the result, as a fully general operation.
xformPointGeneralInPlace | ( | LVecBase3f | v | ) |
The matrix transforms a 3-component point (including translation component), as a fully general operation.
xformPointInPlace | ( | LVecBase3f | v | ) |
The matrix transforms a 3-component point (including translation component).
This assumes the matrix is an affine transform.
LVecBase3f xformVec | ( | const LVecBase3f | v | ) |
The matrix transforms a 3-component vector (without translation component) and returns the result.
This assumes the matrix is an orthonormal transform.
LVecBase3f xformVecGeneral | ( | const LVecBase3f | v | ) |
The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation.
xformVecGeneralInPlace | ( | LVecBase3f | v | ) |
The matrix transforms a 3-component vector (without translation component), as a fully general operation.
xformVecInPlace | ( | LVecBase3f | v | ) |
The matrix transforms a 3-component vector (without translation component).
This assumes the matrix is an orthonormal transform.
|
static |
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.
|
static |
Returns an matrix filled with zeros.
|
static |
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.
LVecBase4f cols[] |
LVecBase4f rows[] |