LMatrix3d

from panda3d.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

Inheritance diagram of LMatrix3d

class CRow

Bases:

__getitem__(i: int) float
__init__(param0: CRow)
static size() int

Returns 3: the number of columns of a LMatrix3.

class Row

Bases:

These helper classes are used to support two-level operator [].

__getitem__(i: int)
__getitem__(i: int) float
__init__(param0: Row)
static size() int

Returns 3: the number of columns of a LMatrix3.

__call__(row: int, col: int)
__call__(row: int, col: int) float
__div__(scalar: float) LMatrix3d
__eq__(other: LMatrix3d) bool
__getitem__(i: int) Row
__getitem__(i: int) CRow
__iadd__(other: LMatrix3d) LMatrix3d

Performs a memberwise addition between two matrices.

__idiv__(scalar: float) LMatrix3d

Performs a memberwise scale.

__imul__(other: LMatrix3d) LMatrix3d
__imul__(scalar: float) LMatrix3d

Performs a memberwise scale.

__init__()
__init__(other: LMatrix3d)
__init__(param0: LVecBase3d, param1: LVecBase3d, param2: LVecBase3d)

Constructs the matrix from three individual rows.

__init__(param0: float, param1: float, param2: float, param3: float, param4: float, param5: float, param6: float, param7: float, param8: float)
__isub__(other: LMatrix3d) LMatrix3d

Performs a memberwise subtraction between two matrices.

__lt__(other: LMatrix3d) bool
__mul__(other: LMatrix3d) LMatrix3d
__mul__(scalar: float) LMatrix3d
__ne__(other: LMatrix3d) bool
__reduce__() object
__repr__() str
__rmul__(scalar: float) LMatrix3d
add_hash(hash: int) int

Adds the vector into the running hash.

add_hash(hash: int, threshold: float) int

Adds the vector into the running hash.

almost_equal(other: LMatrix3d) bool

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

almost_equal(other: LMatrix3d, threshold: float) bool

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

assign(other: LMatrix3d) LMatrix3d
assign(fill_value: float) LMatrix3d
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(other: LMatrix3d) int

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

compare_to(other: LMatrix3d, threshold: float) int

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(other: LMatrix3d)
static convert_mat(from: CoordinateSystem, to: CoordinateSystem) LMatrix3d

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

determinant() float

Returns the determinant of the matrix.

fill(fill_value: float)

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(hashgen: ChecksumHashGenerator)

Adds the vector to the indicated hash generator.

generate_hash(hashgen: ChecksumHashGenerator, threshold: float)

Adds the vector to the indicated hash generator.

get_cell(row: int, col: int) float

Returns a particular element of the matrix.

static get_class_type() TypeHandle
get_col(col: int) LVecBase3d

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

get_col2(col: int) LVecBase2d

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

get_col2s() list
get_cols() list
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() int

Returns a suitable hash for phash_map.

get_hash(threshold: float) int

Returns a suitable hash for phash_map.

get_num_components() int

Returns the number of elements in the matrix, nine.

get_row(result_vec: LVecBase3d, row: int)

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

get_row(row: int) LVecBase3d

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

get_row2(row: int) LVecBase2d

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

get_row2s() list
get_rows() list
static ident_mat() LMatrix3d

Returns an identity matrix.

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

invert_from(other: LMatrix3d) bool

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

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

invert_transpose_from(other: LMatrix3d) bool

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

invert_transpose_from(other: LMatrix4d) bool

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

is_identity() bool

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

is_nan() bool

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

multiply(other1: LMatrix3d, other2: LMatrix3d)

this = other1 * other2

output(out: ostream)
read_datagram(source: DatagramIterator)

Reads the matrix from the Datagram using get_stdfloat().

read_datagram_fixed(scan: DatagramIterator)

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

static rotate_mat(angle: float) LMatrix3d

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

static rotate_mat(angle: float, axis: LVecBase3d, cs: CoordinateSystem) LMatrix3d

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

static rotate_mat_normaxis(angle: float, axis: LVecBase3d, cs: CoordinateSystem) LMatrix3d

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(scale: LVecBase2d) LMatrix3d

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

static scale_mat(scale: LVecBase3d) LMatrix3d

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

static scale_mat(sx: float, sy: float) LMatrix3d

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

static scale_mat(sx: float, sy: float, sz: float) LMatrix3d

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

static scale_shear_mat(scale: LVecBase3d, shear: LVecBase3d, cs: CoordinateSystem) LMatrix3d

Returns a matrix that applies the indicated scale and shear.

static scale_shear_mat(sx: float, sy: float, sz: float, shxy: float, shxz: float, shyz: float, cs: CoordinateSystem) LMatrix3d

Returns a matrix that applies the indicated scale and shear.

set(e00: float, e01: float, e02: float, e10: float, e11: float, e12: float, e20: float, e21: float, e22: float)
set_cell(row: int, col: int, value: float)

Changes a particular element of the matrix.

set_col(col: int, v: LVecBase2d)

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

set_col(col: int, v: LVecBase3d)

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

set_rotate_mat(angle: float)

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

set_rotate_mat(angle: float, axis: LVecBase3d, cs: CoordinateSystem)

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

set_rotate_mat_normaxis(angle: float, axis: LVecBase3d, cs: CoordinateSystem)

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(row: int, v: LVecBase2d)

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

set_row(row: int, v: LVecBase3d)

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

set_scale_mat(scale: LVecBase2d)

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

set_scale_mat(scale: LVecBase3d)

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

set_scale_shear_mat(scale: LVecBase3d, shear: LVecBase3d, cs: CoordinateSystem)

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

set_shear_mat(shear: LVecBase3d, cs: CoordinateSystem)

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

set_translate_mat(trans: LVecBase2d)

Fills mat with a matrix that applies the indicated translation.

static shear_mat(shear: LVecBase3d, cs: CoordinateSystem) LMatrix3d

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

static shear_mat(shxy: float, shxz: float, shyz: float, cs: CoordinateSystem) LMatrix3d

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

static size() int

Returns 3: the number of rows of a LMatrix3.

static translate_mat(trans: LVecBase2d) LMatrix3d

Returns a matrix that applies the indicated translation.

static translate_mat(tx: float, ty: float) LMatrix3d

Returns a matrix that applies the indicated translation.

transpose_from(other: LMatrix3d)
transpose_in_place()
write(out: ostream, indent_level: int)
write_datagram(destination: 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(destination: Datagram)

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(v: LVecBase3d) LVecBase3d

3-component vector or point times matrix.

xform_in_place(v: LVecBase3d)

3-component vector or point times matrix.

xform_point(v: LVecBase2d) LVecBase2d

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(v: LVecBase2d)

The matrix transforms a 2-component point (including translation component). This assumes the matrix is an affine transform.

xform_vec(v: LVecBase2d) LVecBase2d

The matrix transforms a 2-component vector (without translation component) and returns the result. This assumes the matrix is an affine transform.

xform_vec(v: LVecBase3d) LVecBase3d

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(v: LVecBase3d) LVecBase3d

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

xform_vec_general_in_place(v: LVecBase3d)

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

xform_vec_in_place(v: LVecBase2d)

The matrix transforms a 2-component vector (without translation component). This assumes the matrix is an affine transform.

xform_vec_in_place(v: LVecBase3d)

The matrix transforms a 3-component vector. This assumes the matrix is an orthonormal transform.

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