API Reference: LMatrix4f

LMatrix4f

    from pandac.PandaModules import LMatrix4f
    Filename: lmatrix4_src.h Created by: drose (15Jan99)
    PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. All rights reserved.
    All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."
    Class : LMatrix4
    Description : This is a 4-by-4 transform matrix.

Inheritance:

Methods of LMatrix4f:

LMatrix4f
LMatrix4f::LMatrix4f(void);

Construct a 4x4 matrix given a 3x3 rotation matrix and an optional translation component.
Description:

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

Description: Adds the vector into the running hash.

almostEqual
bool LMatrix4f::almost_equal(LMatrix4f const &other, float 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
float const *LMatrix4f::begin(void);

Description: Returns an iterator that may be used to traverse the elements of the matrix, STL-style.

compareTo
int LMatrix4f::compare_to(LMatrix4f 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 LMatrix4f const &LMatrix4f::convert_mat(CoordinateSystem from, CoordinateSystem to);

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

end
float const *LMatrix4f::end(void);

Description: Returns an iterator that may be used to traverse the elements of the matrix, STL-style.

fill
void LMatrix4f::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 LMatrix4f::get_cell(int row, int col) const;

Description: Returns a particular element of the matrix.

getClassType
static TypeHandle LMatrix4f::get_class_type(void);

Undocumented function.

getCol
LVecBase4f LMatrix4f::get_col(int col) const;

Description: Retrieves the indicated column of the matrix as a 4-component vector.

getCol3
LVecBase3f LMatrix4f::get_col3(int col) const;

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

getData
float const *LMatrix4f::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 LMatrix4f::get_hash(void) const;

Description: Returns a suitable hash for phash_map.

getNumComponents
int LMatrix4f::get_num_components(void) const;

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

getRow
LVecBase4f LMatrix4f::get_row(int row) const;

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

getRow3
LVecBase3f LMatrix4f::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
LMatrix3f LMatrix4f::get_upper_3(void) const;

Get and set the upper 3x3 rotation matrix.
Description: Retrieves the upper 3x3 submatrix.

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

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

invertAffineFrom
bool LMatrix4f::invert_affine_from(LMatrix4f 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 LMatrix4f::invert_from(LMatrix4f 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 LMatrix4f::invert_in_place(void);

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

isNan
bool LMatrix4f::is_nan(void) const;

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

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

this = other1 * other2

onesMat
static LMatrix4f const &LMatrix4f::ones_mat(void);

Description: Returns an matrix filled with ones.

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

Description:

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

Description:

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

Description:

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

Description:

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

Description: Performs a memberwise addition between two matrices.

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

Description: Performs a memberwise addition between two matrices.

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

Description:

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

Description:

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

Description:

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

Description:

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

Description:

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

Undocumented function.

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

Undocumented function.

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

Description:

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

Description:

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

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

scaleMat
static LMatrix4f LMatrix4f::scale_mat(LVecBase3f 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 LMatrix4f LMatrix4f::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 LMatrix4f::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);

Description:

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

Description: Changes a particular element of the matrix.

setCol
void LMatrix4f::set_col(int col, LVecBase4f 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 LMatrix4f::set_rotate_mat(float angle, LVecBase3f 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 LMatrix4f::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 prenormalized.

setRow
void LMatrix4f::set_row(int row, LVecBase4f 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 LMatrix4f::set_scale_mat(LVecBase3f const &scale);

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

setScaleShearMat
void LMatrix4f::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 LMatrix4f::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 LMatrix4f::set_translate_mat(LVecBase3f const &trans);

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

setUpper3
void LMatrix4f::set_upper_3(LMatrix3f const &upper3);

Get and set the upper 3x3 rotation matrix.
Description: Sets the upper 3x3 submatrix.

shearMat
static LMatrix4f LMatrix4f::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 LMatrix4f::size(void);

Description: Returns 4: the number of rows of a LMatrix4.

translateMat
static LMatrix4f LMatrix4f::translate_mat(LVecBase3f const &trans);

Description: Returns a matrix that applies the indicated translation.

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

Description:

transposeInPlace
void LMatrix4f::transpose_in_place(void);

Description:

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

Undocumented function.

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

HAVE_PYTHON
Description:

xform
LVecBase4f LMatrix4f::xform(LVecBase4f const &v) const;

Description: 4-component vector or point times matrix. This is a fully general operation.

xformPoint
LVecBase3f LMatrix4f::xform_point(LVecBase3f 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
LVecBase3f LMatrix4f::xform_vec(LVecBase3f const &v) const;

Description: The matrix transforms a 3-component vector (without translation component) and returns the result. This assumes the matrix is an orthonormal transform.

xformVecGeneral
LVecBase3f LMatrix4f::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.

yToZUpMat
static LMatrix4f const &LMatrix4f::y_to_z_up_mat(void);

Description: Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.

zerosMat
static LMatrix4f const &LMatrix4f::zeros_mat(void);

Description: Returns an matrix filled with zeros.

zToYUpMat
static LMatrix4f const &LMatrix4f::z_to_y_up_mat(void);

Description: Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.