LMatrix4d¶
from acron.core import LMatrix4d
- class LMatrix4d¶
Bases:
Bases:
MemoryBaseThis is a 4-by-4 transform matrix.
Inheritance diagram
digraph inheritancefb0fb74d15 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "LMatrix4d" [URL="acron.core.LMatrix4d.html#acron.core.LMatrix4d",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "LMatrix4d" [arrowsize=0.75,style=""]; }- class Row¶
Bases:
These helper classes are used to support two-level operator [].
- __getitem__()¶
- __init__()¶
Defines a row-level index accessor to the matrix.
- __call__()¶
- __div__()¶
- __eq__()¶
- __getitem__()¶
- __iadd__()¶
Performs a memberwise addition between two matrices.
- __idiv__()¶
- __imul__()¶
- __init__()¶
Construct a 4x4 matrix given a 3x3 rotation matrix and an optional translation component.
Constructs the matrix from four individual rows.
- __isub__()¶
Performs a memberwise subtraction between two matrices.
- __lt__()¶
- __mul__()¶
- __ne__()¶
- __reduce__()¶
- __repr__()¶
- __rmul__()¶
- accumulate()¶
Computes
(*this) += other * weight.
- add_hash()¶
Adds the vector into the running hash.
Adds the vector into the running hash.
- almost_equal()¶
Returns true if two matrices are memberwise equal within a default tolerance based on the numeric type.
Returns true if two matrices are memberwise equal within a specified tolerance. This is faster than the equivalence operator as this doesn’t have to guarantee that it is transitive.
- assign()¶
- static begin()¶
Returns an iterator that may be used to traverse the elements of the matrix, STL-style.
Returns an iterator that may be used to traverse the elements of the matrix, STL-style.
- property cols Sequence[LVecBase4d]¶
- Getter
Retrieves the indicated column of the matrix as a 4-component vector.
- Setter
Replaces the indicated column of the matrix.
Replaces the indicated column of the matrix with the indicated 3-component vector, ignoring the last row.
- compare_to()¶
This flavor of compare_to uses a default threshold value based on the numeric type.
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).
- componentwise_mult()¶
- static convert_mat()¶
Returns a matrix that transforms from the indicated coordinate system to the indicated coordinate system.
- static end()¶
Returns an iterator that may be used to traverse the elements of the matrix, STL-style.
Returns an iterator that may be used to traverse the elements of the matrix, STL-style.
- fill()¶
Sets each element of the matrix to the indicated fill_value. This is of questionable value, but is sometimes useful when initializing to zero.
- generate_hash()¶
Adds the vector to the indicated hash generator.
Adds the vector to the indicated hash generator.
- get_cell()¶
Returns a particular element of the matrix.
- static get_class_type()¶
- get_col()¶
Retrieves the indicated column of the matrix as a 4-component vector.
- get_col3()¶
Retrieves the indicated column of the matrix as a 3-component vector, ignoring the last row.
- static get_data()¶
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.
- get_hash()¶
Returns a suitable hash for phash_map.
Returns a suitable hash for phash_map.
- get_num_components()¶
Returns the number of elements in the matrix, 16.
- get_row()¶
these versions inline better
Retrieves the indicated row of the matrix as a 4-component vector.
Stores the indicated row of the matrix as a 4-component vector.
- get_row3()¶
Retrieves the row column of the matrix as a 3-component vector, ignoring the last column.
Stores the row column of the matrix as a 3-component vector, ignoring the last column.
- get_upper_3()¶
Retrieves the upper 3x3 submatrix.
- static ident_mat()¶
Returns an identity matrix.
This function definition must appear first, since some inline functions below take advantage of it.
- invert_affine_from()¶
bugbug: we could optimize this for rotationscaletranslation matrices (transpose upper 3x3 and take negative of translation component)
- invert_from()¶
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.
- invert_in_place()¶
Inverts the current matrix. Returns true if the inverse is successful, false if the matrix was singular.
- is_identity()¶
Returns true if this is (close enough to) the identity matrix, false otherwise.
- is_nan()¶
Returns true if any component of the matrix is not-a-number, false otherwise.
- multiply()¶
this = other1 * other2
this = other1 * other2
- static ones_mat()¶
Returns an matrix filled with ones.
- static operator_delete()¶
- static operator_delete()¶
- static operator_new()¶
- static operator_new()¶
- output()¶
- read_datagram()¶
Reads the matrix from the Datagram using get_stdfloat().
- read_datagram_fixed()¶
Reads the matrix from the Datagram using get_float32() or get_float64(). See
write_datagram_fixed().
- static rotate_mat()¶
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
- static rotate_mat_normaxis()¶
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. Assumes axis has been prenormalized.
- property rows Sequence[LVecBase4d]¶
- Getter
these versions inline better
Retrieves the indicated row of the matrix as a 4-component vector.
Stores the indicated row of the matrix as a 4-component vector.
- Setter
Replaces the indicated row of the matrix.
Replaces the indicated row of the matrix with the indicated 3-component vector, ignoring the last column.
- static scale_mat()¶
Returns a matrix that applies the indicated scale in each of the three axes.
Returns a matrix that applies the indicated scale in each of the three axes.
Returns a matrix that applies the indicated uniform scale.
- static scale_shear_mat()¶
Returns a matrix that applies the indicated scale and shear.
Returns a matrix that applies the indicated scale and shear.
- set()¶
- set_cell()¶
Changes a particular element of the matrix.
- set_col()¶
Replaces the indicated column of the matrix.
Replaces the indicated column of the matrix with the indicated 3-component vector, ignoring the last row.
- set_rotate_mat()¶
Sets mat to a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector.
- set_rotate_mat_normaxis()¶
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. Assumes axis has been prenormalized.
- set_row()¶
Replaces the indicated row of the matrix.
Replaces the indicated row of the matrix with the indicated 3-component vector, ignoring the last column.
- set_scale_mat()¶
Fills mat with a matrix that applies the indicated scale in each of the three axes.
- set_scale_shear_mat()¶
Fills mat with a matrix that applies the indicated scale and shear.
- set_shear_mat()¶
Fills mat with a matrix that applies the indicated shear in each of the three planes.
- set_translate_mat()¶
Fills mat with a matrix that applies the indicated translation.
- set_upper_3()¶
Get and set the upper 3x3 rotation matrix.
Sets the upper 3x3 submatrix.
- static shear_mat()¶
Returns a matrix that applies the indicated shear in each of the three planes.
Returns a matrix that applies the indicated shear in each of the three planes.
- static translate_mat()¶
Returns a matrix that applies the indicated translation.
Returns a matrix that applies the indicated translation.
- transpose_from()¶
- transpose_in_place()¶
- static validate_ptr()¶
- write()¶
- write_datagram()¶
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.
- write_datagram_fixed()¶
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.
- xform()¶
4-component vector or point times matrix. This is a fully general operation.
- xform_in_place()¶
4-component vector or point times matrix. This is a fully general operation.
- xform_point()¶
The matrix transforms a 3-component point (including translation component) and returns the result. This assumes the matrix is an affine transform.
- xform_point_general()¶
The matrix transforms a 3-component point (including translation component) and returns the result, as a fully general operation.
- xform_point_general_in_place()¶
The matrix transforms a 3-component point (including translation component), as a fully general operation.
- xform_point_in_place()¶
The matrix transforms a 3-component point (including translation component). This assumes the matrix is an affine transform.
- xform_vec()¶
The matrix transforms a 3-component vector (without translation component) and returns the result. This assumes the matrix is an orthonormal transform.
- xform_vec_general()¶
The matrix transforms a 3-component vector (without translation component) and returns the result, as a fully general operation.
- xform_vec_general_in_place()¶
The matrix transforms a 3-component vector (without translation component), as a fully general operation.
- xform_vec_in_place()¶
The matrix transforms a 3-component vector (without translation component). This assumes the matrix is an orthonormal transform.
- static y_to_z_up_mat()¶
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.
- static z_to_y_up_mat()¶
Returns a matrix that transforms from the Y-up coordinate system to the Z-up coordinate system.
- static zeros_mat()¶
Returns an matrix filled with zeros.