Panda3D
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
LMatrix3f Class Reference

This is a 3-by-3 transform matrix. More...

#include "lmatrix.h"

Classes

class  CRow
 
class  Row
 

Public Types

enum  { num_components = 9, is_int = 0 }
 
typedef const float * const_iterator
 
typedef LSimpleMatrix< float, 3, 3 > EMatrix3
 
typedef const float * iterator
 
typedef float numeric_type
 

Public Member Functions

 LMatrix3f (const LMatrix3f &other)
 
 LMatrix3f (float e00, float e01, float e02, float e10, float e11, float e12, float e20, float e21, float e22)
 
 LMatrix3f (const EMatrix3 &m)
 
size_t add_hash (size_t hash) const
 Adds the vector into the running hash. More...
 
size_t add_hash (size_t hash, float threshold) const
 Adds the vector into the running hash. More...
 
bool almost_equal (const LMatrix3f &other, float threshold) const
 Returns true if two matrices are memberwise equal within a specified tolerance. More...
 
bool almost_equal (const LMatrix3f &other) const
 Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type. More...
 
iterator begin ()
 Returns an iterator that may be used to traverse the elements of the matrix, STL-style. More...
 
const_iterator begin () const
 Returns an iterator that may be used to traverse the elements of the matrix, STL-style. More...
 
int compare_to (const LMatrix3f &other) const
 This flavor of compare_to uses a default threshold value based on the numeric type. More...
 
int compare_to (const LMatrix3f &other, float threshold) const
 Sorts matrices lexicographically, componentwise. More...
 
void componentwise_mult (const LMatrix3f &other)
 
float determinant () const
 Returns the determinant of the matrix. More...
 
iterator end ()
 Returns an iterator that may be used to traverse the elements of the matrix, STL-style. More...
 
const_iterator end () const
 Returns an iterator that may be used to traverse the elements of the matrix, STL-style. More...
 
void fill (float fill_value)
 Sets each element of the matrix to the indicated fill_value. More...
 
void generate_hash (ChecksumHashGenerator &hashgen) const
 Adds the vector to the indicated hash generator. More...
 
void generate_hash (ChecksumHashGenerator &hashgen, float threshold) const
 Adds the vector to the indicated hash generator. More...
 
float get_cell (int row, int col) const
 Returns a particular element of the matrix. More...
 
LVecBase3f get_col (int col) const
 Returns the indicated column of the matrix as a three-component vector. More...
 
LVecBase2f get_col2 (int col) const
 Returns the indicated column of the matrix as a two-component vector, ignoring the last row. More...
 
const float * get_data () const
 Returns the address of the first of the nine data elements in the matrix. More...
 
size_t get_hash () const
 Returns a suitable hash for phash_map. More...
 
size_t get_hash (float threshold) const
 Returns a suitable hash for phash_map. More...
 
int get_num_components () const
 Returns the number of elements in the matrix, nine. More...
 
LVecBase3f get_row (int row) const
 Returns the indicated row of the matrix as a three-component vector. More...
 
void get_row (LVecBase3f &result_vec, int row) const
 Stores the indicated row of the matrix as a three-component vector. More...
 
LVecBase2f get_row2 (int row) const
 Returns the indicated row of the matrix as a two-component vector, ignoring the last column. More...
 
bool invert_from (const LMatrix3f &other)
 Computes the inverse of the other matrix, and stores the result in this matrix. More...
 
bool invert_in_place ()
 Inverts the current matrix. More...
 
bool invert_transpose_from (const LMatrix3f &other)
 Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse. More...
 
bool invert_transpose_from (const LMatrix4f &other)
 Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse. More...
 
bool is_identity () const
 Returns true if this is (close enough to) the identity matrix, false otherwise. More...
 
bool is_nan () const
 Returns true if any component of the matrix is not-a-number, false otherwise. More...
 
 MAKE_SEQ (get_rows, size, get_row)
 
 MAKE_SEQ (get_cols, size, get_col)
 
 MAKE_SEQ (get_col2s, size, get_col2)
 
 MAKE_SEQ (get_row2s, size, get_row2)
 
void multiply (const LMatrix3f &other1, const LMatrix3f &other2)
 
bool operator!= (const LMatrix3f &other) const
 
float & operator() (int row, int col)
 
float operator() (int row, int col) const
 
LMatrix3f operator* (const LMatrix3f &other) const
 
LMatrix3f operator* (float scalar) const
 
LMatrix3foperator*= (const LMatrix3f &other)
 
LMatrix3foperator*= (float scalar)
 Performs a memberwise scale. More...
 
LMatrix3foperator+= (const LMatrix3f &other)
 Performs a memberwise addition between two matrices. More...
 
LMatrix3foperator-= (const LMatrix3f &other)
 Performs a memberwise subtraction between two matrices. More...
 
LMatrix3f operator/ (float scalar) const
 
LMatrix3foperator/= (float scalar)
 Performs a memberwise scale. More...
 
bool operator< (const LMatrix3f &other) const
 This performs a lexicographical comparison. More...
 
LMatrix3foperator= (const LMatrix3f &other)
 
LMatrix3foperator= (float fill_value)
 
bool operator== (const LMatrix3f &other) const
 
CRow operator[] (int i) const
 
Row operator[] (int i)
 
void output (ostream &out) const
 
void read_datagram (DatagramIterator &source)
 Reads the matrix from the Datagram using get_stdfloat(). More...
 
void read_datagram_fixed (DatagramIterator &scan)
 Reads the matrix from the Datagram using get_float32() or get_float64(). More...
 
void set (float e00, float e01, float e02, float e10, float e11, float e12, float e20, float e21, float e22)
 
void set_cell (int row, int col, float value)
 Changes a particular element of the matrix. More...
 
void set_col (int col, const LVecBase3f &v)
 Replaces the indicated column of the matrix from a three-component vector. More...
 
void set_col (int col, const LVecBase2f &v)
 Replaces the indicated column of the matrix from a two-component vector, ignoring the last row. More...
 
void set_rotate_mat (float angle)
 Fills mat with a matrix that rotates by the given angle in degrees counterclockwise. More...
 
void set_rotate_mat (float angle, const LVecBase3f &axis, CoordinateSystem cs=CS_default)
 Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More...
 
void set_rotate_mat_normaxis (float angle, const LVecBase3f &axis, CoordinateSystem cs=CS_default)
 Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More...
 
void set_row (int row, const LVecBase3f &v)
 Replaces the indicated row of the matrix from a three-component vector. More...
 
void set_row (int row, const LVecBase2f &v)
 Replaces the indicated row of the matrix from a two-component vector, ignoring the last column. More...
 
void set_scale_mat (const LVecBase2f &scale)
 Fills mat with a matrix that applies the indicated scale in each of the two axes. More...
 
void set_scale_mat (const LVecBase3f &scale)
 Fills mat with a matrix that applies the indicated scale in each of the three axes. More...
 
void set_scale_shear_mat (const LVecBase3f &scale, const LVecBase3f &shear, CoordinateSystem cs=CS_default)
 Fills mat with a matrix that applies the indicated scale and shear. More...
 
void set_shear_mat (const LVecBase3f &shear, CoordinateSystem cs=CS_default)
 Fills mat with a matrix that applies the indicated shear in each of the three planes. More...
 
void set_translate_mat (const LVecBase2f &trans)
 Fills mat with a matrix that applies the indicated translation. More...
 
void transpose_from (const LMatrix3f &other)
 
void transpose_in_place ()
 
void write (ostream &out, int indent_level=0) const
 
void write_datagram (Datagram &destination) const
 Writes the matrix to the Datagram using add_stdfloat(). More...
 
void write_datagram_fixed (Datagram &destination) const
 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...
 
LVecBase3f xform (const LVecBase3f &v) const
 3-component vector or point times matrix. More...
 
void xform_in_place (LVecBase3f &v) const
 3-component vector or point times matrix. More...
 
LVecBase2f xform_point (const LVecBase2f &v) const
 The matrix transforms a 2-component point (including translation component) and returns the result. More...
 
void xform_point_in_place (LVecBase2f &v) const
 The matrix transforms a 2-component point (including translation component). More...
 
LVecBase2f xform_vec (const LVecBase2f &v) const
 The matrix transforms a 2-component vector (without translation component) and returns the result. More...
 
LVecBase3f xform_vec (const LVecBase3f &v) const
 The matrix transforms a 3-component vector and returns the result. More...
 
LVecBase3f xform_vec_general (const LVecBase3f &v) const
 The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation. More...
 
void xform_vec_general_in_place (LVecBase3f &v) const
 The matrix transforms a 3-component vector (without translation component), as a fully general operation. More...
 
void xform_vec_in_place (LVecBase2f &v) const
 The matrix transforms a 2-component vector (without translation component). More...
 
void xform_vec_in_place (LVecBase3f &v) const
 The matrix transforms a 3-component vector. More...
 

Static Public Member Functions

static const LMatrix3fconvert_mat (CoordinateSystem from, CoordinateSystem to)
 Returns a matrix that transforms from the indicated coordinate system to the indicated coordinate system. More...
 
static TypeHandle get_class_type ()
 
static const LMatrix3fident_mat ()
 Returns an identity matrix. More...
 
static void init_type ()
 
static LMatrix3f rotate_mat (float angle)
 Returns a matrix that rotates by the given angle in degrees counterclockwise. More...
 
static LMatrix3f rotate_mat (float angle, const LVecBase3f &axis, CoordinateSystem cs=CS_default)
 Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More...
 
static LMatrix3f rotate_mat_normaxis (float angle, const LVecBase3f &axis, CoordinateSystem cs=CS_default)
 Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. More...
 
static LMatrix3f scale_mat (const LVecBase2f &scale)
 Returns a matrix that applies the indicated scale in each of the two axes. More...
 
static LMatrix3f scale_mat (float sx, float sy)
 Returns a matrix that applies the indicated scale in each of the two axes. More...
 
static LMatrix3f scale_mat (const LVecBase3f &scale)
 Returns a matrix that applies the indicated scale in each of the three axes. More...
 
static LMatrix3f scale_mat (float sx, float sy, float sz)
 Returns a matrix that applies the indicated scale in each of the three axes. More...
 
static LMatrix3f scale_shear_mat (const LVecBase3f &scale, const LVecBase3f &shear, CoordinateSystem cs=CS_default)
 Returns a matrix that applies the indicated scale and shear. More...
 
static LMatrix3f scale_shear_mat (float sx, float sy, float sz, float shxy, float shxz, float shyz, CoordinateSystem cs=CS_default)
 Returns a matrix that applies the indicated scale and shear. More...
 
static LMatrix3f shear_mat (const LVecBase3f &shear, CoordinateSystem cs=CS_default)
 Returns a matrix that applies the indicated shear in each of the three planes. More...
 
static LMatrix3f shear_mat (float shxy, float shxz, float shyz, CoordinateSystem cs=CS_default)
 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 LMatrix3f translate_mat (const LVecBase2f &trans)
 Returns a matrix that applies the indicated translation. More...
 
static LMatrix3f translate_mat (float tx, float ty)
 Returns a matrix that applies the indicated translation. More...
 

Public Attributes

EMatrix3 _m
 

Detailed 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.

Definition at line 110 of file lmatrix.h.

Member Function Documentation

◆ add_hash() [1/2]

size_t LMatrix3f::add_hash ( size_t  hash) const
inline

Adds the vector into the running hash.

Definition at line 3325 of file lmatrix.h.

◆ add_hash() [2/2]

size_t LMatrix3f::add_hash ( size_t  hash,
float  threshold 
) const
inline

Adds the vector into the running hash.

Definition at line 3335 of file lmatrix.h.

References floating_point_hash< Key >::add_hash().

◆ almost_equal() [1/2]

bool LMatrix3f::almost_equal ( const LMatrix3f other,
float  threshold 
) const

Returns true if two matrices are memberwise equal within a specified tolerance.

Definition at line 419 of file lmatrix.cxx.

Referenced by FFTCompressor::write_hprs().

◆ almost_equal() [2/2]

bool LMatrix3f::almost_equal ( const LMatrix3f other) const
inline

Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type.

Definition at line 4257 of file lmatrix.h.

◆ begin() [1/2]

LMatrix3f::iterator LMatrix3f::begin ( )
inline

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

Definition at line 3217 of file lmatrix.h.

◆ begin() [2/2]

LMatrix3f::const_iterator LMatrix3f::begin ( ) const
inline

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

Definition at line 3239 of file lmatrix.h.

◆ compare_to() [1/2]

int LMatrix3f::compare_to ( const LMatrix3f other) const
inline

This flavor of compare_to uses a default threshold value based on the numeric type.

Definition at line 3295 of file lmatrix.h.

◆ compare_to() [2/2]

int LMatrix3f::compare_to ( const LMatrix3f other,
float  threshold 
) const

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).

Definition at line 287 of file lmatrix.cxx.

◆ convert_mat()

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

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

Definition at line 200 of file lmatrix.cxx.

◆ determinant()

float LMatrix3f::determinant ( ) const
inline

Returns the determinant of the matrix.

Definition at line 3799 of file lmatrix.h.

◆ end() [1/2]

LMatrix3f::iterator LMatrix3f::end ( )
inline

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

Definition at line 3228 of file lmatrix.h.

◆ end() [2/2]

LMatrix3f::const_iterator LMatrix3f::end ( ) const
inline

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

Definition at line 3250 of file lmatrix.h.

◆ fill()

void LMatrix3f::fill ( float  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.

Definition at line 266 of file lmatrix.cxx.

◆ generate_hash() [1/2]

void LMatrix3f::generate_hash ( ChecksumHashGenerator hashgen) const
inline

Adds the vector to the indicated hash generator.

Definition at line 4267 of file lmatrix.h.

◆ generate_hash() [2/2]

void LMatrix3f::generate_hash ( ChecksumHashGenerator hashgen,
float  threshold 
) const

Adds the vector to the indicated hash generator.

Definition at line 488 of file lmatrix.cxx.

References ChecksumHashGenerator::add_fp().

◆ get_cell()

float LMatrix3f::get_cell ( int  row,
int  col 
) const
inline

Returns a particular element of the matrix.

Definition at line 3172 of file lmatrix.h.

◆ get_col()

LVecBase3f LMatrix3f::get_col ( int  col) const
inline

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

Definition at line 3056 of file lmatrix.h.

◆ get_col2()

LVecBase2f LMatrix3f::get_col2 ( int  col) const
inline

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

Definition at line 3082 of file lmatrix.h.

◆ get_data()

const float * LMatrix3f::get_data ( ) const
inline

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.

Definition at line 3196 of file lmatrix.h.

Referenced by Shader::get_language(), and PhysxManager::mat3_to_nxMat33().

◆ get_hash() [1/2]

size_t LMatrix3f::get_hash ( ) const
inline

Returns a suitable hash for phash_map.

Definition at line 3305 of file lmatrix.h.

◆ get_hash() [2/2]

size_t LMatrix3f::get_hash ( float  threshold) const
inline

Returns a suitable hash for phash_map.

Definition at line 3315 of file lmatrix.h.

◆ get_num_components()

int LMatrix3f::get_num_components ( ) const
inline

Returns the number of elements in the matrix, nine.

Definition at line 3206 of file lmatrix.h.

Referenced by Shader::get_language().

◆ get_row() [1/2]

LVecBase3f LMatrix3f::get_row ( int  row) const
inline

Returns the indicated row of the matrix as a three-component vector.

Definition at line 3024 of file lmatrix.h.

Referenced by GeomVertexWriter::add_matrix3f(), and GeomVertexWriter::set_matrix3f().

◆ get_row() [2/2]

void LMatrix3f::get_row ( LVecBase3f result_vec,
int  row 
) const
inline

Stores the indicated row of the matrix as a three-component vector.

Definition at line 3039 of file lmatrix.h.

◆ get_row2()

LVecBase2f LMatrix3f::get_row2 ( int  row) const
inline

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

Definition at line 3071 of file lmatrix.h.

◆ ident_mat()

const LMatrix3f & LMatrix3f::ident_mat ( )
inlinestatic

Returns an identity matrix.

This function definition must appear first, since some inline functions below take advantage of it.

Definition at line 2863 of file lmatrix.h.

Referenced by PhysxActor::get_c_mass_global_orientation(), PhysxActor::get_c_mass_local_orientation(), PhysxActor::get_global_inertia_tensor(), PhysxActor::get_global_inertia_tensor_inverse(), and GeomVertexReader::get_matrix3f().

◆ invert_from()

bool LMatrix3f::invert_from ( const LMatrix3f other)
inline

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.

Definition at line 3826 of file lmatrix.h.

Referenced by LQuaternionf::ident_quat().

◆ invert_in_place()

bool LMatrix3f::invert_in_place ( )
inline

Inverts the current matrix.

Returns true if the inverse is successful, false if the matrix was singular.

Definition at line 3885 of file lmatrix.h.

◆ invert_transpose_from() [1/2]

bool LMatrix3f::invert_transpose_from ( const LMatrix3f other)
inline

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

Definition at line 3898 of file lmatrix.h.

◆ invert_transpose_from() [2/2]

bool LMatrix3f::invert_transpose_from ( const LMatrix4f other)
inline

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

Definition at line 3955 of file lmatrix.h.

◆ is_identity()

bool LMatrix3f::is_identity ( ) const
inline

Returns true if this is (close enough to) the identity matrix, false otherwise.

Definition at line 3162 of file lmatrix.h.

◆ is_nan()

bool LMatrix3f::is_nan ( ) const
inline

◆ operator*=()

LMatrix3f & LMatrix3f::operator*= ( float  scalar)
inline

Performs a memberwise scale.

Definition at line 3683 of file lmatrix.h.

◆ operator+=()

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

Performs a memberwise addition between two matrices.

Definition at line 3623 of file lmatrix.h.

◆ operator-=()

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

Performs a memberwise subtraction between two matrices.

Definition at line 3646 of file lmatrix.h.

◆ operator/=()

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

Performs a memberwise scale.

Definition at line 3706 of file lmatrix.h.

◆ operator<()

bool LMatrix3f::operator< ( const LMatrix3f other) const
inline

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

Definition at line 3264 of file lmatrix.h.

◆ read_datagram()

void LMatrix3f::read_datagram ( DatagramIterator source)

Reads the matrix from the Datagram using get_stdfloat().

Definition at line 563 of file lmatrix.cxx.

References DatagramIterator::get_stdfloat(), and TypeHandle::none().

◆ read_datagram_fixed()

void LMatrix3f::read_datagram_fixed ( DatagramIterator scan)

Reads the matrix from the Datagram using get_float32() or get_float64().

See write_datagram_fixed().

Definition at line 528 of file lmatrix.cxx.

References DatagramIterator::get_float32(), and DatagramIterator::get_float64().

◆ rotate_mat() [1/2]

LMatrix3f LMatrix3f::rotate_mat ( float  angle)
inlinestatic

Returns a matrix that rotates by the given angle in degrees counterclockwise.

Definition at line 4081 of file lmatrix.h.

References LMatrix4f::set_rotate_mat().

Referenced by CullableObject::munge_geom(), and RopeNode::reset_bound().

◆ rotate_mat() [2/2]

LMatrix3f LMatrix3f::rotate_mat ( float  angle,
const LVecBase3f axis,
CoordinateSystem  cs = CS_default 
)
inlinestatic

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

Definition at line 4120 of file lmatrix.h.

References LMatrix4f::set_rotate_mat().

◆ rotate_mat_normaxis()

LMatrix3f LMatrix3f::rotate_mat_normaxis ( float  angle,
const LVecBase3f axis,
CoordinateSystem  cs = CS_default 
)
inlinestatic

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

Assumes axis has been normalized.

Definition at line 4135 of file lmatrix.h.

References LMatrix4f::set_rotate_mat_normaxis().

◆ scale_mat() [1/4]

LMatrix3f LMatrix3f::scale_mat ( const LVecBase2f scale)
inlinestatic

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

Definition at line 4094 of file lmatrix.h.

◆ scale_mat() [2/4]

LMatrix3f LMatrix3f::scale_mat ( float  sx,
float  sy 
)
inlinestatic

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

Definition at line 4107 of file lmatrix.h.

◆ scale_mat() [3/4]

LMatrix3f LMatrix3f::scale_mat ( const LVecBase3f scale)
inlinestatic

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

Definition at line 4162 of file lmatrix.h.

◆ scale_mat() [4/4]

LMatrix3f LMatrix3f::scale_mat ( float  sx,
float  sy,
float  sz 
)
inlinestatic

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

Definition at line 4175 of file lmatrix.h.

◆ scale_shear_mat() [1/2]

LMatrix3f LMatrix3f::scale_shear_mat ( const LVecBase3f scale,
const LVecBase3f shear,
CoordinateSystem  cs = CS_default 
)
inlinestatic

Returns a matrix that applies the indicated scale and shear.

Definition at line 4226 of file lmatrix.h.

References LMatrix4f::set_scale_shear_mat().

◆ scale_shear_mat() [2/2]

LMatrix3f LMatrix3f::scale_shear_mat ( float  sx,
float  sy,
float  sz,
float  shxy,
float  shxz,
float  shyz,
CoordinateSystem  cs = CS_default 
)
inlinestatic

Returns a matrix that applies the indicated scale and shear.

Definition at line 4241 of file lmatrix.h.

References LMatrix4f::set_scale_shear_mat().

◆ set_cell()

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

Changes a particular element of the matrix.

Definition at line 3183 of file lmatrix.h.

◆ set_col() [1/2]

void LMatrix3f::set_col ( int  col,
const LVecBase3f v 
)
inline

Replaces the indicated column of the matrix from a three-component vector.

Definition at line 2975 of file lmatrix.h.

◆ set_col() [2/2]

void LMatrix3f::set_col ( int  col,
const LVecBase2f v 
)
inline

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

Definition at line 3008 of file lmatrix.h.

◆ set_rotate_mat() [1/2]

void LMatrix3f::set_rotate_mat ( float  angle)
inline

Fills mat with a matrix that rotates by the given angle in degrees counterclockwise.

Definition at line 4025 of file lmatrix.h.

◆ set_rotate_mat() [2/2]

void LMatrix3f::set_rotate_mat ( float  angle,
const LVecBase3f axis,
CoordinateSystem  cs = CS_default 
)

Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.

Definition at line 307 of file lmatrix.cxx.

◆ set_rotate_mat_normaxis()

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

Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.

Assumes axis has been normalized.

Definition at line 368 of file lmatrix.cxx.

Referenced by DriveInterface::force_dgraph().

◆ set_row() [1/2]

void LMatrix3f::set_row ( int  row,
const LVecBase3f v 
)
inline

Replaces the indicated row of the matrix from a three-component vector.

Definition at line 2958 of file lmatrix.h.

Referenced by GeomVertexReader::get_matrix3f().

◆ set_row() [2/2]

void LMatrix3f::set_row ( int  row,
const LVecBase2f v 
)
inline

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

Definition at line 2992 of file lmatrix.h.

◆ set_scale_mat() [1/2]

void LMatrix3f::set_scale_mat ( const LVecBase2f scale)
inline

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

Definition at line 4042 of file lmatrix.h.

◆ set_scale_mat() [2/2]

void LMatrix3f::set_scale_mat ( const LVecBase3f scale)
inline

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

Definition at line 4149 of file lmatrix.h.

◆ set_scale_shear_mat()

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

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

Definition at line 121 of file lmatrix.cxx.

◆ set_shear_mat()

void LMatrix3f::set_shear_mat ( const LVecBase3f shear,
CoordinateSystem  cs = CS_default 
)
inline

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

Definition at line 4188 of file lmatrix.h.

◆ set_translate_mat()

void LMatrix3f::set_translate_mat ( const LVecBase2f trans)
inline

Fills mat with a matrix that applies the indicated translation.

Definition at line 4012 of file lmatrix.h.

◆ shear_mat() [1/2]

LMatrix3f LMatrix3f::shear_mat ( const LVecBase3f shear,
CoordinateSystem  cs = CS_default 
)
inlinestatic

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

Definition at line 4200 of file lmatrix.h.

References LMatrix4f::set_shear_mat().

◆ shear_mat() [2/2]

LMatrix3f LMatrix3f::shear_mat ( float  shxy,
float  shxz,
float  shyz,
CoordinateSystem  cs = CS_default 
)
inlinestatic

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

Definition at line 4213 of file lmatrix.h.

References LMatrix4f::set_shear_mat().

◆ size()

int LMatrix3f::size ( )
inlinestatic

Returns 3: the number of rows of a LMatrix3.

Definition at line 3136 of file lmatrix.h.

◆ translate_mat() [1/2]

LMatrix3f LMatrix3f::translate_mat ( const LVecBase2f trans)
inlinestatic

Returns a matrix that applies the indicated translation.

Definition at line 4055 of file lmatrix.h.

◆ translate_mat() [2/2]

LMatrix3f LMatrix3f::translate_mat ( float  tx,
float  ty 
)
inlinestatic

Returns a matrix that applies the indicated translation.

Definition at line 4068 of file lmatrix.h.

◆ write_datagram()

void LMatrix3f::write_datagram ( Datagram destination) const

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.

Definition at line 549 of file lmatrix.cxx.

References Datagram::add_stdfloat().

◆ write_datagram_fixed()

void LMatrix3f::write_datagram_fixed ( Datagram destination) const

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.

Definition at line 509 of file lmatrix.cxx.

References Datagram::add_float32(), and Datagram::add_float64().

◆ xform()

LVecBase3f LMatrix3f::xform ( const LVecBase3f v) const
inline

3-component vector or point times matrix.

Definition at line 3365 of file lmatrix.h.

◆ xform_in_place()

void LMatrix3f::xform_in_place ( LVecBase3f v) const
inline

3-component vector or point times matrix.

Definition at line 3467 of file lmatrix.h.

◆ xform_point()

LVecBase2f LMatrix3f::xform_point ( const LVecBase2f v) const
inline

The matrix transforms a 2-component point (including translation component) and returns the result.

This assumes the matrix is an affine transform.

Definition at line 3385 of file lmatrix.h.

◆ xform_point_in_place()

void LMatrix3f::xform_point_in_place ( LVecBase2f v) const
inline

The matrix transforms a 2-component point (including translation component).

This assumes the matrix is an affine transform.

Definition at line 3484 of file lmatrix.h.

◆ xform_vec() [1/2]

LVecBase2f LMatrix3f::xform_vec ( const LVecBase2f v) const
inline

The matrix transforms a 2-component vector (without translation component) and returns the result.

This assumes the matrix is an affine transform.

Definition at line 3409 of file lmatrix.h.

◆ xform_vec() [2/2]

LVecBase3f LMatrix3f::xform_vec ( const LVecBase3f v) const
inline

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

Definition at line 3436 of file lmatrix.h.

◆ xform_vec_general()

LVecBase3f LMatrix3f::xform_vec_general ( const LVecBase3f v) const
inline

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

Definition at line 3449 of file lmatrix.h.

◆ xform_vec_general_in_place()

void LMatrix3f::xform_vec_general_in_place ( LVecBase3f v) const
inline

The matrix transforms a 3-component vector (without translation component), as a fully general operation.

Definition at line 3535 of file lmatrix.h.

◆ xform_vec_in_place() [1/2]

void LMatrix3f::xform_vec_in_place ( LVecBase2f v) const
inline

The matrix transforms a 2-component vector (without translation component).

This assumes the matrix is an affine transform.

Definition at line 3503 of file lmatrix.h.

◆ xform_vec_in_place() [2/2]

void LMatrix3f::xform_vec_in_place ( LVecBase3f v) const
inline

The matrix transforms a 3-component vector.

This assumes the matrix is an orthonormal transform.

In practice, this is the same computation as xform().

Definition at line 3523 of file lmatrix.h.


The documentation for this class was generated from the following files: