API Reference: LMatrix3f

LMatrix3f

    from pandac.PandaModules import LMatrix3f
    Class : LMatrix3
    Description : 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.

Inheritance:

Methods of LMatrix3f:

LMatrix3f
LMatrix3f::LMatrix3f(void);

Description:

addHash
unsigned int LMatrix3f::add_hash(unsigned int hash) const;

Description: Adds the vector into the running hash.

almostEqual
bool LMatrix3f::almost_equal(LMatrix3f const &other, float threshold) const;

We don't have a scale_mat() that takes a single uniform scale parameter, because it would be ambiguous whether we mean a 2-d or a 3-d scale.
Description: Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type.
Description: Returns true if two matrices are memberwise equal within a specified tolerance.

compareTo
int LMatrix3f::compare_to(LMatrix3f const &other) const;

Description: This flavor of compare_to uses a default threshold value based on the numeric type.
Description: 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).

convertMat
static LMatrix3f const &LMatrix3f::convert_mat(CoordinateSystem from, CoordinateSystem to);

Description: Returns a matrix that transforms from the indicated coordinate system to the indicated coordinate system.

determinant
float LMatrix3f::determinant(void) const;

Description: Returns the determinant of the matrix.

fill
void LMatrix3f::fill(float fill_value);

Description: Sets each element of the matrix to the indicated fill_value. This is of questionable value, but is sometimes useful when initializing to zero.

getCell
float LMatrix3f::get_cell(int row, int col) const;

Description: Returns a particular element of the matrix.

getClassType
static TypeHandle LMatrix3f::get_class_type(void);

Undocumented function.

getCol
LVecBase3f LMatrix3f::get_col(int col) const;

Description: Returns the indicated column of the matrix as a three-component vector.

getCol2
LVecBase2f LMatrix3f::get_col2(int col) const;

Description: Returns the indicated column of the matrix as a two-component vector, ignoring the last row.

getData
float const *LMatrix3f::get_data(void) const;

Description: 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.

getHash
unsigned int LMatrix3f::get_hash(void) const;

Description: Returns a suitable hash for phash_map.

getNumComponents
int LMatrix3f::get_num_components(void) const;

Description: Returns the number of elements in the matrix, nine.

getRow
LVecBase3f LMatrix3f::get_row(int row) const;

these versions inline better
Description: Returns the indicated row of the matrix as a three-component vector.

getRow2
LVecBase2f LMatrix3f::get_row2(int row) const;

Description: Returns the indicated row of the matrix as a two-component vector, ignoring the last column.

identMat
static LMatrix3f const &LMatrix3f::ident_mat(void);

Description: Returns an identity matrix.
This function definition must appear first, since some inline functions below take advantage of it.

invertFrom
bool LMatrix3f::invert_from(LMatrix3f const &other);

Description: 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.

invertInPlace
bool LMatrix3f::invert_in_place(void);

Description: Inverts the current matrix. Returns true if the inverse is successful, false if the matrix was singular.

invertTransposeFrom
bool LMatrix3f::invert_transpose_from(LMatrix3f const &other);

Description: Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse.

isNan
bool LMatrix3f::is_nan(void) const;

Description: Returns true if any component of the matrix is not-a-number, false otherwise.

multiply
void LMatrix3f::multiply(LMatrix3f const &other1, LMatrix3f const &other2);

this = other1 * other2

operator !=
bool LMatrix3f::operator !=(LMatrix3f const &other) const;

Description:

operator ()
float &LMatrix3f::operator ()(int row, int col);

Description:

operator *
LMatrix3f LMatrix3f::operator *(LMatrix3f const &other) const;

Description:

operator *=
LMatrix3f &LMatrix3f::operator *=(LMatrix3f const &other);

Description:
Description: Performs a memberwise scale.

operator +=
LMatrix3f &LMatrix3f::operator +=(LMatrix3f const &other);

Description: Performs a memberwise addition between two matrices.

operator -=
LMatrix3f &LMatrix3f::operator -=(LMatrix3f const &other);

Description: Performs a memberwise subtraction between two matrices.

operator /
LMatrix3f LMatrix3f::operator /(float scalar) const;

Description:

operator /=
LMatrix3f &LMatrix3f::operator /=(float scalar);

Description: Performs a memberwise scale.

operator <
bool LMatrix3f::operator <(LMatrix3f const &other) const;

Description: 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().

operator =
LMatrix3f &LMatrix3f::operator =(LMatrix3f const &other);

Description:

operator ==
bool LMatrix3f::operator ==(LMatrix3f const &other) const;

Description:

operator []
LMatrix3f::CRow LMatrix3f::operator [](int i) const;

Description:

operator delete
void LMatrix3f::operator delete(void *ptr);

Undocumented function.

operator new
void *LMatrix3f::operator new(unsigned int size);

Undocumented function.

output
void LMatrix3f::output(ostream &out) const;

Description:

pythonRepr
void LMatrix3f::python_repr(ostream &out, string const &class_name) const;

Description:

rotateMat
static LMatrix3f LMatrix3f::rotate_mat(float angle);

Description: Returns a matrix that rotates by the given angle in degrees counterclockwise.
Description: Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.

rotateMatNormaxis
static LMatrix3f LMatrix3f::rotate_mat_normaxis(float angle, LVecBase3f const &axis, CoordinateSystem cs = (CS_default));

Description: Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. Assumes axis has been normalized.

scaleMat
static LMatrix3f LMatrix3f::scale_mat(LVecBase2f const &scale);

Description: Returns a matrix that applies the indicated scale in each of the two axes.
Description: Returns a matrix that applies the indicated scale in each of the three axes.

scaleShearMat
static LMatrix3f LMatrix3f::scale_shear_mat(LVecBase3f const &scale, LVecBase3f const &shear, CoordinateSystem cs = (CS_default));

Description: Returns a matrix that applies the indicated scale and shear.

set
void LMatrix3f::set(float e00, float e01, float e02, float e10, float e11, float e12, float e20, float e21, float e22);

Description:

setCell
void LMatrix3f::set_cell(int row, int col, float value);

Description: Changes a particular element of the matrix.

setCol
void LMatrix3f::set_col(int col, LVecBase3f const &v);

Description: Replaces the indicated column of the matrix from a three-component vector.
Description: Replaces the indicated column of the matrix from a two-component vector, ignoring the last row.

setRotateMat
void LMatrix3f::set_rotate_mat(float angle);

The following named constructors return 3x3 matrices suitable for scale/rotate transforms in 3-d coordinate space.
Description: Fills mat with a matrix that rotates by the given angle in degrees counterclockwise.
Description: Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.

setRotateMatNormaxis
void LMatrix3f::set_rotate_mat_normaxis(float angle, LVecBase3f const &axis, CoordinateSystem cs = (CS_default));

Description: Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. Assumes axis has been normalized.

setRow
void LMatrix3f::set_row(int row, LVecBase3f const &v);

Description: Replaces the indicated row of the matrix from a three-component vector.
Description: Replaces the indicated row of the matrix from a two-component vector, ignoring the last column.

setScaleMat
void LMatrix3f::set_scale_mat(LVecBase2f const &scale);

Description: Fills mat with a matrix that applies the indicated scale in each of the two axes.
Description: Fills mat with a matrix that applies the indicated scale in each of the three axes.

setScaleShearMat
void LMatrix3f::set_scale_shear_mat(LVecBase3f const &scale, LVecBase3f const &shear, CoordinateSystem cs = (CS_default));

Description: Fills mat with a matrix that applies the indicated scale and shear.

setShearMat
void LMatrix3f::set_shear_mat(LVecBase3f const &shear, CoordinateSystem cs = (CS_default));

Description: Fills mat with a matrix that applies the indicated shear in each of the three planes.

setTranslateMat
void LMatrix3f::set_translate_mat(LVecBase2f const &trans);

Description: Fills mat with a matrix that applies the indicated translation.

shearMat
static LMatrix3f LMatrix3f::shear_mat(LVecBase3f const &shear, CoordinateSystem cs = (CS_default));

Description: Returns a matrix that applies the indicated shear in each of the three planes.

size
static int LMatrix3f::size(void);

Description: Returns 3: the number of rows of a LMatrix3.

translateMat
static LMatrix3f LMatrix3f::translate_mat(LVecBase2f const &trans);

Description: Returns a matrix that applies the indicated translation.

transposeFrom
void LMatrix3f::transpose_from(LMatrix3f const &other);

Description:

transposeInPlace
void LMatrix3f::transpose_in_place(void);

Description:

validatePtr
static bool LMatrix3f::validate_ptr(void const *ptr);

Undocumented function.

write
void LMatrix3f::write(ostream &out, int indent_level = (0)) const;

Description:

xform
LVecBase3f LMatrix3f::xform(LVecBase3f const &v) const;

Description: 3-component vector or point times matrix.

xformPoint
LVecBase2f LMatrix3f::xform_point(LVecBase2f const &v) const;

Description: The matrix transforms a 2-component point (including translation component) and returns the result. This assumes the matrix is an affine transform.

xformVec
LVecBase2f LMatrix3f::xform_vec(LVecBase2f const &v) const;

Description: The matrix transforms a 2-component vector (without translation component) and returns the result. This assumes the matrix is an affine transform.
Description: 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().

xformVecGeneral
LVecBase3f LMatrix3f::xform_vec_general(LVecBase3f const &v) const;

Description: The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation.