# LMatrix3d

from pandac.PandaModules import LMatrix3d

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:

LMatrix3d:

## Methods of LMatrix3d:

addHash
almostEqual
compareTo
convertMat
determinant
fill
getCell
getClassType
getCol
getCol2
getData
getHash
getNumComponents
getRow
getRow2
identMat
invertFrom
invertInPlace
invertTransposeFrom
isNan
multiply
operator !=
operator ()
operator *
operator *=
operator +=
operator -=
operator /
operator /=
operator <
operator =
operator ==
operator delete
operator new
output
pythonRepr
rotateMat
rotateMatNormaxis
scaleMat
scaleShearMat
set
setCell
setCol
setRotateMat
setRotateMatNormaxis
setRow
setScaleMat
setScaleShearMat
setShearMat
setTranslateMat
shearMat
translateMat
transposeFrom
transposeInPlace
validatePtr
write
xform
xformPoint
xformVec
xformVecGeneral

addHash unsigned int LMatrix3d::add_hash(unsigned int hash) const; Description: Adds the vector into the running hash.

almostEqual bool LMatrix3d::almost_equal(LMatrix3d const &other, double 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 LMatrix3d::compare_to(LMatrix3d 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 LMatrix3d const &LMatrix3d::convert_mat(CoordinateSystem from, CoordinateSystem to); Description: Returns a matrix that transforms from the indicated coordinate system to the indicated coordinate system.

determinant double LMatrix3d::determinant(void) const; Description: Returns the determinant of the matrix.

fill void LMatrix3d::fill(double 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 double LMatrix3d::get_cell(int row, int col) const; Description: Returns a particular element of the matrix.

getClassType static TypeHandle LMatrix3d::get_class_type(void); Undocumented function.

getCol LVecBase3d LMatrix3d::get_col(int col) const; Description: Returns the indicated column of the matrix as a three-component vector.

getCol2 LVecBase2d LMatrix3d::get_col2(int col) const; Description: Returns the indicated column of the matrix as a two-component vector, ignoring the last row.

getData double const *LMatrix3d::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 LMatrix3d::get_hash(void) const; Description: Returns a suitable hash for phash_map.

getNumComponents int LMatrix3d::get_num_components(void) const; Description: Returns the number of elements in the matrix, nine.

getRow LVecBase3d LMatrix3d::get_row(int row) const; these versions inline better Description: Returns the indicated row of the matrix as a three-component vector.

getRow2 LVecBase2d LMatrix3d::get_row2(int row) const; Description: Returns the indicated row of the matrix as a two-component vector, ignoring the last column.

identMat static LMatrix3d const &LMatrix3d::ident_mat(void); Filename: lmatrix3_src.I Created by: drose (29Jan99) PANDA 3D SOFTWARE Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved All use of this software is subject to the terms of the Panda 3d Software license. You should have received a copy of this license along with this source code; you will also find a current copy of the license at http://etc.cmu.edu/panda3d/docs/license/ . To contact the maintainers of this program write to panda3d-general@lists.sourceforge.net . Description: Returns an identity matrix. This function definition must appear first, since some inline functions below take advantage of it.

invertFrom bool LMatrix3d::invert_from(LMatrix3d 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 LMatrix3d::invert_in_place(void); Description: Inverts the current matrix. Returns true if the inverse is successful, false if the matrix was singular.

invertTransposeFrom bool LMatrix3d::invert_transpose_from(LMatrix3d const &other); Description: Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse.

isNan bool LMatrix3d::is_nan(void) const; Description: Returns true if any component of the matrix is not-a-number, false otherwise.

multiply void LMatrix3d::multiply(LMatrix3d const &other1, LMatrix3d const &other2); this = other1 * other2

operator != bool LMatrix3d::operator !=(LMatrix3d const &other) const; Description:

operator () double &LMatrix3d::operator ()(int row, int col); Description:

operator * LMatrix3d LMatrix3d::operator *(LMatrix3d const &other) const; Description:

operator *= LMatrix3d &LMatrix3d::operator *=(LMatrix3d const &other); Description: Description: Performs a memberwise scale.

operator += LMatrix3d &LMatrix3d::operator +=(LMatrix3d const &other); Description: Performs a memberwise addition between two matrices.

operator -= LMatrix3d &LMatrix3d::operator -=(LMatrix3d const &other); Description: Performs a memberwise subtraction between two matrices.

operator / LMatrix3d LMatrix3d::operator /(double scalar) const; Description:

operator /= LMatrix3d &LMatrix3d::operator /=(double scalar); Description: Performs a memberwise scale.

operator < bool LMatrix3d::operator <(LMatrix3d 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 = LMatrix3d &LMatrix3d::operator =(LMatrix3d const &other); Description:

operator == bool LMatrix3d::operator ==(LMatrix3d const &other) const; Description:

operator delete void LMatrix3d::operator delete(void *ptr); Undocumented function.

operator new void *LMatrix3d::operator new(unsigned int size); Undocumented function.

output void LMatrix3d::output(ostream &out) const; Description:

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

rotateMat static LMatrix3d LMatrix3d::rotate_mat(double 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 LMatrix3d LMatrix3d::rotate_mat_normaxis(double angle, LVecBase3d 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 LMatrix3d LMatrix3d::scale_mat(LVecBase2d 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 LMatrix3d LMatrix3d::scale_shear_mat(LVecBase3d const &scale, LVecBase3d const &shear, CoordinateSystem cs = (CS_default)); Description: Returns a matrix that applies the indicated scale and shear.

set void LMatrix3d::set(double e00, double e01, double e02, double e10, double e11, double e12, double e20, double e21, double e22); Description:

setCell void LMatrix3d::set_cell(int row, int col, double value); Description: Changes a particular element of the matrix.

setCol void LMatrix3d::set_col(int col, LVecBase3d 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 LMatrix3d::set_rotate_mat(double 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 LMatrix3d::set_rotate_mat_normaxis(double angle, LVecBase3d 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 LMatrix3d::set_row(int row, LVecBase3d 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 LMatrix3d::set_scale_mat(LVecBase2d 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 LMatrix3d::set_scale_shear_mat(LVecBase3d const &scale, LVecBase3d const &shear, CoordinateSystem cs = (CS_default)); Description: Fills mat with a matrix that applies the indicated scale and shear.

setShearMat void LMatrix3d::set_shear_mat(LVecBase3d 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 LMatrix3d::set_translate_mat(LVecBase2d const &trans); Description: Fills mat with a matrix that applies the indicated translation.

shearMat static LMatrix3d LMatrix3d::shear_mat(LVecBase3d const &shear, CoordinateSystem cs = (CS_default)); Description: Returns a matrix that applies the indicated shear in each of the three planes.

translateMat static LMatrix3d LMatrix3d::translate_mat(LVecBase2d const &trans); Description: Returns a matrix that applies the indicated translation.

transposeFrom void LMatrix3d::transpose_from(LMatrix3d const &other); Description:

transposeInPlace void LMatrix3d::transpose_in_place(void); Description:

validatePtr static bool LMatrix3d::validate_ptr(void const *ptr); Undocumented function.

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

xform LVecBase3d LMatrix3d::xform(LVecBase3d const &v) const; Description: 3-component vector or point times matrix.

xformPoint LVecBase2d LMatrix3d::xform_point(LVecBase2d 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 LVecBase2d LMatrix3d::xform_vec(LVecBase2d 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 LVecBase3d LMatrix3d::xform_vec_general(LVecBase3d const &v) const; Description: The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation.