Panda3D
|
This is a 3-by-3 transform matrix. More...
#include <pandadoc.hpp>
Classes | |
class | CRow |
class | Row |
Public Types | |
enum | { num_components = 9 , is_int = 0 } |
Public Member Functions | |
__init__ () | |
__init__ (const LMatrix3d other) | |
__init__ (const LVecBase3d, const LVecBase3d, const LVecBase3d) | |
Constructs the matrix from three individual rows. More... | |
__init__ (double, double, double, double, double, double, double, double, double) | |
object | __reduce__ () |
str | __repr__ () |
int | addHash (int hash) |
Adds the vector into the running hash. More... | |
int | addHash (int hash, double threshold) |
Adds the vector into the running hash. More... | |
bool | almostEqual (const LMatrix3d other) |
Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type. More... | |
bool | almostEqual (const LMatrix3d other, double threshold) |
Returns true if two matrices are memberwise equal within a specified tolerance. More... | |
int | compareTo (const LMatrix3d other) |
This flavor of compare_to uses a default threshold value based on the numeric type. More... | |
int | compareTo (const LMatrix3d other, double threshold) |
Sorts matrices lexicographically, componentwise. More... | |
componentwiseMult (const LMatrix3d other) | |
double | determinant () |
Returns the determinant of the matrix. More... | |
fill (double 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, double threshold) | |
Adds the vector to the indicated hash generator. More... | |
double | getCell (int row, int col) |
Returns a particular element of the matrix. More... | |
LVecBase3d | getCol (int col) |
Returns the indicated column of the matrix as a three-component vector. More... | |
LVecBase2d | getCol2 (int col) |
Returns the indicated column of the matrix as a two-component vector, ignoring the last row. More... | |
list | getCol2s () |
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 (double threshold) |
Returns a suitable hash for phash_map. More... | |
int | getNumComponents () |
Returns the number of elements in the matrix, nine. More... | |
LVecBase3d | getRow (int row) |
Returns the indicated row of the matrix as a three-component vector. More... | |
getRow (LVecBase3d result_vec, int row) | |
Stores the indicated row of the matrix as a three-component vector. More... | |
LVecBase2d | getRow2 (int row) |
Returns the indicated row of the matrix as a two-component vector, ignoring the last column. More... | |
list | getRow2s () |
list | getRows () |
bool | invertFrom (const LMatrix3d other) |
Computes the inverse of the other matrix, and stores the result in this matrix. More... | |
bool | invertInPlace () |
Inverts the current matrix. More... | |
bool | invertTransposeFrom (const LMatrix3d other) |
Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse. More... | |
bool | invertTransposeFrom (const LMatrix4d other) |
Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse. 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 LMatrix3d other1, const LMatrix3d other2) | |
operator new (int size) | |
bool | operator!= (const LMatrix3d other) |
operator() (int row, int col) | |
double | operator() (int row, int col) |
LMatrix3d | operator* (const LMatrix3d other) |
LMatrix3d | operator* (double scalar) |
LMatrix3d | operator*= (const LMatrix3d other) |
LMatrix3d | operator*= (double scalar) |
Performs a memberwise scale. More... | |
LMatrix3d | operator+= (const LMatrix3d other) |
Performs a memberwise addition between two matrices. More... | |
LMatrix3d | operator-= (const LMatrix3d other) |
Performs a memberwise subtraction between two matrices. More... | |
LMatrix3d | operator/ (double scalar) |
LMatrix3d | operator/= (double scalar) |
Performs a memberwise scale. More... | |
bool | operator< (const LMatrix3d other) |
LMatrix3d | operator= (const LMatrix3d other) |
LMatrix3d | operator= (double fill_value) |
bool | operator== (const LMatrix3d other) |
LMatrix3d::Row | operator[] (int i) |
LMatrix3d::CRow | operator[] (int i) |
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 (double e00, double e01, double e02, double e10, double e11, double e12, double e20, double e21, double e22) | |
setCell (int row, int col, double value) | |
Changes a particular element of the matrix. More... | |
setCol (int col, const LVecBase2d v) | |
Replaces the indicated column of the matrix from a two-component vector, ignoring the last row. More... | |
setCol (int col, const LVecBase3d v) | |
Replaces the indicated column of the matrix from a three-component vector. More... | |
setRotateMat (double angle) | |
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise. More... | |
setRotateMat (double angle, const LVecBase3d axis, CoordinateSystem cs) | |
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More... | |
setRotateMatNormaxis (double angle, const LVecBase3d 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 LVecBase2d v) | |
Replaces the indicated row of the matrix from a two-component vector, ignoring the last column. More... | |
setRow (int row, const LVecBase3d v) | |
Replaces the indicated row of the matrix from a three-component vector. More... | |
setScaleMat (const LVecBase2d scale) | |
Fills mat with a matrix that applies the indicated scale in each of the two axes. More... | |
setScaleMat (const LVecBase3d scale) | |
Fills mat with a matrix that applies the indicated scale in each of the three axes. More... | |
setScaleShearMat (const LVecBase3d scale, const LVecBase3d shear, CoordinateSystem cs) | |
Fills mat with a matrix that applies the indicated scale and shear. More... | |
setShearMat (const LVecBase3d shear, CoordinateSystem cs) | |
Fills mat with a matrix that applies the indicated shear in each of the three planes. More... | |
setTranslateMat (const LVecBase2d trans) | |
Fills mat with a matrix that applies the indicated translation. More... | |
transposeFrom (const LMatrix3d 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... | |
LVecBase3d | xform (const LVecBase3d v) |
3-component vector or point times matrix. More... | |
xformInPlace (LVecBase3d v) | |
3-component vector or point times matrix. More... | |
LVecBase2d | xformPoint (const LVecBase2d v) |
The matrix transforms a 2-component point (including translation component) and returns the result. More... | |
xformPointInPlace (LVecBase2d v) | |
The matrix transforms a 2-component point (including translation component). More... | |
LVecBase2d | xformVec (const LVecBase2d v) |
The matrix transforms a 2-component vector (without translation component) and returns the result. More... | |
LVecBase3d | xformVec (const LVecBase3d v) |
The matrix transforms a 3-component vector and returns the result. More... | |
LVecBase3d | xformVecGeneral (const LVecBase3d v) |
The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation. More... | |
xformVecGeneralInPlace (LVecBase3d v) | |
The matrix transforms a 3-component vector (without translation component), as a fully general operation. More... | |
xformVecInPlace (LVecBase2d v) | |
The matrix transforms a 2-component vector (without translation component). More... | |
xformVecInPlace (LVecBase3d v) | |
The matrix transforms a 3-component vector. More... | |
Static Public Member Functions | |
static const LMatrix3d | 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 LMatrix3d | identMat () |
Returns an identity matrix. More... | |
static LMatrix3d | rotateMat (double angle) |
Returns a matrix that rotates by the given angle in degrees counterclockwise. More... | |
static LMatrix3d | rotateMat (double angle, const LVecBase3d axis, CoordinateSystem cs) |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More... | |
static LMatrix3d | rotateMatNormaxis (double angle, const LVecBase3d axis, CoordinateSystem cs) |
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More... | |
static LMatrix3d | scaleMat (const LVecBase2d scale) |
Returns a matrix that applies the indicated scale in each of the two axes. More... | |
static LMatrix3d | scaleMat (const LVecBase3d scale) |
Returns a matrix that applies the indicated scale in each of the three axes. More... | |
static LMatrix3d | scaleMat (double sx, double sy) |
Returns a matrix that applies the indicated scale in each of the two axes. More... | |
static LMatrix3d | scaleMat (double sx, double sy, double sz) |
Returns a matrix that applies the indicated scale in each of the three axes. More... | |
static LMatrix3d | scaleShearMat (const LVecBase3d scale, const LVecBase3d shear, CoordinateSystem cs) |
Returns a matrix that applies the indicated scale and shear. More... | |
static LMatrix3d | 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. More... | |
static LMatrix3d | shearMat (const LVecBase3d shear, CoordinateSystem cs) |
Returns a matrix that applies the indicated shear in each of the three planes. More... | |
static LMatrix3d | shearMat (double shxy, double shxz, double shyz, CoordinateSystem cs) |
Returns a matrix that applies the indicated shear in each of the three planes. More... | |
static int | size () |
Returns 3: the number of rows of a LMatrix3. More... | |
static LMatrix3d | translateMat (const LVecBase2d trans) |
Returns a matrix that applies the indicated translation. More... | |
static LMatrix3d | translateMat (double tx, double ty) |
Returns a matrix that applies the indicated translation. More... | |
Public Attributes | |
LVecBase3d | cols [] |
Returns the indicated column of the matrix as a three-component vector. More... | |
LVecBase3d | rows [] |
Returns the indicated row of the matrix as a three-component vector. More... | |
This is a 3-by-3 transform matrix.
It typically will represent either a rotation-and-scale (no translation) matrix in 3-d, or a full affine matrix (rotation, scale, translation) in 2-d, e.g. for a texture matrix.
__init__ | ( | ) |
__init__ | ( | const LMatrix3d | other | ) |
__init__ | ( | const | LVecBase3d, |
const | LVecBase3d, | ||
const | LVecBase3d | ||
) |
Constructs the matrix from three individual rows.
__init__ | ( | double | , |
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | , | ||
double | |||
) |
object __reduce__ | ( | ) |
str __repr__ | ( | ) |
int addHash | ( | int | hash | ) |
Adds the vector into the running hash.
int addHash | ( | int | hash, |
double | threshold | ||
) |
Adds the vector into the running hash.
bool almostEqual | ( | const LMatrix3d | other | ) |
Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual | ( | const LMatrix3d | other, |
double | threshold | ||
) |
Returns true if two matrices are memberwise equal within a specified tolerance.
int compareTo | ( | const LMatrix3d | other | ) |
This flavor of compare_to uses a default threshold value based on the numeric type.
int compareTo | ( | const LMatrix3d | other, |
double | 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 LMatrix3d | other | ) |
|
static |
Returns a matrix that transforms from the indicated coordinate system to the indicated coordinate system.
double determinant | ( | ) |
Returns the determinant of the matrix.
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.
generateHash | ( | ChecksumHashGenerator | hashgen | ) |
Adds the vector to the indicated hash generator.
generateHash | ( | ChecksumHashGenerator | hashgen, |
double | threshold | ||
) |
Adds the vector to the indicated hash generator.
double getCell | ( | int | row, |
int | col | ||
) |
Returns a particular element of the matrix.
|
static |
LVecBase3d getCol | ( | int | col | ) |
Returns the indicated column of the matrix as a three-component vector.
LVecBase2d getCol2 | ( | int | col | ) |
Returns the indicated column of the matrix as a two-component vector, ignoring the last row.
list getCol2s | ( | ) |
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 | ( | double | threshold | ) |
Returns a suitable hash for phash_map.
int getNumComponents | ( | ) |
Returns the number of elements in the matrix, nine.
LVecBase3d getRow | ( | int | row | ) |
Returns the indicated row of the matrix as a three-component vector.
getRow | ( | LVecBase3d | result_vec, |
int | row | ||
) |
Stores the indicated row of the matrix as a three-component vector.
LVecBase2d getRow2 | ( | int | row | ) |
Returns the indicated row of the matrix as a two-component vector, ignoring the last column.
list getRow2s | ( | ) |
list getRows | ( | ) |
|
static |
Returns an identity matrix.
This function definition must appear first, since some inline functions below take advantage of it.
bool invertFrom | ( | const LMatrix3d | 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 there was a singularity.
bool invertInPlace | ( | ) |
Inverts the current matrix.
Returns true if the inverse is successful, false if the matrix was singular.
bool invertTransposeFrom | ( | const LMatrix3d | other | ) |
Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse.
bool invertTransposeFrom | ( | const LMatrix4d | other | ) |
Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse.
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.
operator new | ( | int | size | ) |
bool operator!= | ( | const LMatrix3d | other | ) |
operator() | ( | int | row, |
int | col | ||
) |
double operator() | ( | int | row, |
int | col | ||
) |
LMatrix3d operator* | ( | double | scalar | ) |
LMatrix3d operator*= | ( | double | scalar | ) |
Performs a memberwise scale.
Performs a memberwise subtraction between two matrices.
LMatrix3d operator/ | ( | double | scalar | ) |
LMatrix3d operator/= | ( | double | scalar | ) |
Performs a memberwise scale.
bool operator< | ( | const LMatrix3d | other | ) |
LMatrix3d operator= | ( | double | fill_value | ) |
bool operator== | ( | const LMatrix3d | other | ) |
LMatrix3d::Row operator[] | ( | int | i | ) |
LMatrix3d::CRow operator[] | ( | int | i | ) |
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.
|
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 normalized.
|
static |
Returns a matrix that applies the indicated scale in each of the two axes.
|
static |
Returns a matrix that applies the indicated scale in each of the three axes.
|
static |
Returns a matrix that applies the indicated scale in each of the two axes.
|
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 | ( | double | e00, |
double | e01, | ||
double | e02, | ||
double | e10, | ||
double | e11, | ||
double | e12, | ||
double | e20, | ||
double | e21, | ||
double | e22 | ||
) |
setCell | ( | int | row, |
int | col, | ||
double | value | ||
) |
Changes a particular element of the matrix.
setCol | ( | int | col, |
const LVecBase2d | v | ||
) |
Replaces the indicated column of the matrix from a two-component vector, ignoring the last row.
setCol | ( | int | col, |
const LVecBase3d | v | ||
) |
Replaces the indicated column of the matrix from a three-component vector.
setRotateMat | ( | double | angle | ) |
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise.
setRotateMat | ( | double | angle, |
const LVecBase3d | axis, | ||
CoordinateSystem | cs | ||
) |
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
setRotateMatNormaxis | ( | double | angle, |
const LVecBase3d | 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 normalized.
setRow | ( | int | row, |
const LVecBase2d | v | ||
) |
Replaces the indicated row of the matrix from a two-component vector, ignoring the last column.
setRow | ( | int | row, |
const LVecBase3d | v | ||
) |
Replaces the indicated row of the matrix from a three-component vector.
setScaleMat | ( | const LVecBase2d | scale | ) |
Fills mat with a matrix that applies the indicated scale in each of the two axes.
setScaleMat | ( | const LVecBase3d | scale | ) |
Fills mat with a matrix that applies the indicated scale in each of the three axes.
setScaleShearMat | ( | const LVecBase3d | scale, |
const LVecBase3d | shear, | ||
CoordinateSystem | cs | ||
) |
Fills mat with a matrix that applies the indicated scale and shear.
setShearMat | ( | const LVecBase3d | shear, |
CoordinateSystem | cs | ||
) |
Fills mat with a matrix that applies the indicated shear in each of the three planes.
setTranslateMat | ( | const LVecBase2d | trans | ) |
Fills mat with a matrix that applies the indicated translation.
|
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 3: the number of rows of a LMatrix3.
|
static |
Returns a matrix that applies the indicated translation.
|
static |
Returns a matrix that applies the indicated translation.
transposeFrom | ( | const LMatrix3d | 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.
LVecBase3d xform | ( | const LVecBase3d | v | ) |
3-component vector or point times matrix.
xformInPlace | ( | LVecBase3d | v | ) |
3-component vector or point times matrix.
LVecBase2d xformPoint | ( | const LVecBase2d | v | ) |
The matrix transforms a 2-component point (including translation component) and returns the result.
This assumes the matrix is an affine transform.
xformPointInPlace | ( | LVecBase2d | v | ) |
The matrix transforms a 2-component point (including translation component).
This assumes the matrix is an affine transform.
LVecBase2d xformVec | ( | const LVecBase2d | v | ) |
The matrix transforms a 2-component vector (without translation component) and returns the result.
This assumes the matrix is an affine transform.
LVecBase3d xformVec | ( | const LVecBase3d | v | ) |
The matrix transforms a 3-component vector and returns the result.
This assumes the matrix is an orthonormal transform.
In practice, this is the same computation as xform().
LVecBase3d xformVecGeneral | ( | const LVecBase3d | v | ) |
The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation.
xformVecGeneralInPlace | ( | LVecBase3d | v | ) |
The matrix transforms a 3-component vector (without translation component), as a fully general operation.
xformVecInPlace | ( | LVecBase2d | v | ) |
The matrix transforms a 2-component vector (without translation component).
This assumes the matrix is an affine transform.
xformVecInPlace | ( | LVecBase3d | v | ) |
The matrix transforms a 3-component vector.
This assumes the matrix is an orthonormal transform.
In practice, this is the same computation as xform().
LVecBase3d cols[] |
Returns the indicated column of the matrix as a three-component vector.
LVecBase3d rows[] |
Returns the indicated row of the matrix as a three-component vector.
Stores the indicated row of the matrix as a three-component vector.