LMatrix3d¶
from acron.core import LMatrix3d
- class LMatrix3d¶
Bases:
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 diagram
digraph inheritance08f2bc924c { 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=""]; "LMatrix3d" [URL="acron.core.LMatrix3d.html#acron.core.LMatrix3d",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" -> "LMatrix3d" [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__()¶
Performs a memberwise scale.
- __imul__()¶
Performs a memberwise scale.
- __init__()¶
Constructs the matrix from three individual rows.
- __isub__()¶
Performs a memberwise subtraction between two matrices.
- __lt__()¶
- __mul__()¶
- __ne__()¶
- __reduce__()¶
- __repr__()¶
- __rmul__()¶
- 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.
- assign()¶
- property cols Sequence[LVecBase3d]¶
- Getter
Returns the indicated column of the matrix as a three-component vector.
- Setter
Replaces the indicated column of the matrix from a three-component vector.
Replaces the indicated column of the matrix from a two-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.
- determinant()¶
Returns the determinant of the matrix.
- 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()¶
Returns the indicated column of the matrix as a three-component vector.
- get_col2()¶
Returns the indicated column of the matrix as a two-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, nine.
- get_row()¶
these versions inline better
Returns the indicated row of the matrix as a three-component vector.
Stores the indicated row of the matrix as a three-component vector.
- get_row2()¶
Returns the indicated row of the matrix as a two-component vector, ignoring the last column.
- static ident_mat()¶
Returns an identity matrix.
This function definition must appear first, since some inline functions below take advantage of it.
- 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 there was a singularity.
- invert_in_place()¶
Inverts the current matrix. Returns true if the inverse is successful, false if the matrix was singular.
- invert_transpose_from()¶
Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse.
Simultaneously computes the inverse of the indicated matrix, and then the transpose of that inverse.
- 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 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.
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 normalized.
- property rows Sequence[LVecBase3d]¶
- Getter
these versions inline better
Returns the indicated row of the matrix as a three-component vector.
Stores the indicated row of the matrix as a three-component vector.
- Setter
Replaces the indicated row of the matrix from a three-component vector.
Replaces the indicated row of the matrix from a two-component vector, ignoring the last column.
- static scale_mat()¶
Returns a matrix that applies the indicated scale in each of the two axes.
Returns a matrix that applies the indicated scale in each of the two axes.
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.
- 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 from a three-component vector.
Replaces the indicated column of the matrix from a two-component vector, ignoring the last row.
- set_rotate_mat()¶
Fills mat with a matrix that rotates by the given angle in degrees counterclockwise.
Fills mat with 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 normalized.
- set_row()¶
Replaces the indicated row of the matrix from a three-component vector.
Replaces the indicated row of the matrix from a two-component vector, ignoring the last column.
- set_scale_mat()¶
Fills mat with a matrix that applies the indicated scale in each of the two axes.
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.
- 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()¶
3-component vector or point times matrix.
- xform_in_place()¶
3-component vector or point times matrix.
- xform_point()¶
The matrix transforms a 2-component point (including translation component) and returns the result. This assumes the matrix is an affine transform.
- xform_point_in_place()¶
The matrix transforms a 2-component point (including translation component). This assumes the matrix is an affine transform.
- xform_vec()¶
The matrix transforms a 2-component vector (without translation component) and returns the result. This assumes the matrix is an affine transform.
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().
- 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.