# LMatrix4d

from pandac.PandaModules import LMatrix4d

Filename: lmatrix4_src.h Created by: drose (15Jan99)
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 .
Class : LMatrix4
Description : This is a 4-by-4 transform matrix.

## Inheritance:

LMatrix4d:

## Methods of LMatrix4d:

addHash
almostEqual
begin
compareTo
convertMat
end
fill
getCell
getClassType
getCol
getCol3
getData
getHash
getNumComponents
getRow
getRow3
getUpper3
identMat
invertAffineFrom
invertFrom
invertInPlace
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
setUpper3
shearMat
translateMat
transposeFrom
transposeInPlace
validatePtr
write
xform
xformPoint
xformVec
yToZUpMat
zToYUpMat

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

almostEqual bool LMatrix4d::almost_equal(LMatrix4d const &other, double threshold) const; 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.

begin double const *LMatrix4d::begin(void); Description: Returns an iterator that may be used to traverse the elements of the matrix, STL-style.

compareTo int LMatrix4d::compare_to(LMatrix4d 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 LMatrix4d const &LMatrix4d::convert_mat(CoordinateSystem from, CoordinateSystem to); Description: Returns a matrix that transforms from the indicated coordinate system to the indicated coordinate system.

end double const *LMatrix4d::end(void); Description: Returns an iterator that may be used to traverse the elements of the matrix, STL-style.

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

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

getCol LVecBase4d LMatrix4d::get_col(int col) const; Description: Retrieves the indicated column of the matrix as a 4-component vector.

getCol3 LVecBase3d LMatrix4d::get_col3(int col) const; Description: Retrieves the indicated column of the matrix as a 3-component vector, ignoring the last row.

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

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

getRow LVecBase4d LMatrix4d::get_row(int row) const; these versions inline better Description: Retrieves the indicated row of the matrix as a 4-component vector.

getRow3 LVecBase3d LMatrix4d::get_row3(int row) const; these versions inline better Description: Retrieves the row column of the matrix as a 3-component vector, ignoring the last column.

getUpper3 LMatrix3d LMatrix4d::get_upper_3(void) const; Get and set the upper 3x3 rotation matrix. Description: Retrieves the upper 3x3 submatrix.

identMat static LMatrix4d const &LMatrix4d::ident_mat(void); Filename: lmatrix4_src.I Created by: drose (15Jan99) 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.

invertAffineFrom bool LMatrix4d::invert_affine_from(LMatrix4d const &other); Description: 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)

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

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

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

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

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

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

operator *= LMatrix4d &LMatrix4d::operator *=(LMatrix4d const &other); Description:

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

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

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

operator /= LMatrix4d &LMatrix4d::operator /=(double scalar); Description:

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

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

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

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

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

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

rotateMat static LMatrix4d LMatrix4d::rotate_mat(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.

rotateMatNormaxis static LMatrix4d LMatrix4d::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 prenormalized.

scaleMat static LMatrix4d LMatrix4d::scale_mat(LVecBase3d const &scale); Description: Returns a matrix that applies the indicated scale in each of the three axes. Description: Returns a matrix that applies the indicated uniform scale.

scaleShearMat static LMatrix4d LMatrix4d::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 LMatrix4d::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); Description:

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

setCol void LMatrix4d::set_col(int col, LVecBase4d const &v); Description: Replaces the indicated column of the matrix. Description: Replaces the indicated column of the matrix with the indicated 3-component vector, ignoring the last row.

setRotateMat void LMatrix4d::set_rotate_mat(double angle, LVecBase3d const &axis, CoordinateSystem cs = (CS_default)); Description: Sets mat to a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.

setRotateMatNormaxis void LMatrix4d::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 prenormalized.

setRow void LMatrix4d::set_row(int row, LVecBase4d const &v); Description: Replaces the indicated row of the matrix. Description: Replaces the indicated row of the matrix with the indicated 3-component vector, ignoring the last column.

setScaleMat void LMatrix4d::set_scale_mat(LVecBase3d const &scale); Description: Fills mat with a matrix that applies the indicated scale in each of the three axes.

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

setUpper3 void LMatrix4d::set_upper_3(LMatrix3d const &upper3); Get and set the upper 3x3 rotation matrix. Description: Sets the upper 3x3 submatrix.

shearMat static LMatrix4d LMatrix4d::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 LMatrix4d LMatrix4d::translate_mat(LVecBase3d const &trans); Description: Returns a matrix that applies the indicated translation.

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

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

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

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

xform LVecBase4d LMatrix4d::xform(LVecBase4d const &v) const; Description: 4-component vector or point times matrix. This is a fully general operation.

xformPoint LVecBase3d LMatrix4d::xform_point(LVecBase3d const &v) const; Description: The matrix transforms a 3-component point (including translation component) and returns the result. This assumes the matrix is an affine transform.

xformVec LVecBase3d LMatrix4d::xform_vec(LVecBase3d const &v) const; Description: The matrix transforms a 3-component vector (without translation component) and returns the result. This assumes the matrix is an affine transform.

yToZUpMat static LMatrix4d const &LMatrix4d::y_to_z_up_mat(void); Description: Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.

zToYUpMat static LMatrix4d const &LMatrix4d::z_to_y_up_mat(void); Description: Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.