LMatrix3f

from panda3d.core import LMatrix3f
class LMatrix3f

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 LMatrix3f

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, assign_val: float)
__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) LMatrix3f
__eq__(other: LMatrix3f) bool
__getitem__(i: int) Row
__getitem__(i: int) CRow
__iadd__(other: LMatrix3f) LMatrix3f

Performs a memberwise addition between two matrices.

__idiv__(scalar: float) LMatrix3f

Performs a memberwise scale.

__imul__(other: LMatrix3f) LMatrix3f
__imul__(scalar: float) LMatrix3f

Performs a memberwise scale.

__init__()
__init__(other: LMatrix3f)
__init__(param0: LVecBase3f, param1: LVecBase3f, param2: LVecBase3f)

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: LMatrix3f) LMatrix3f

Performs a memberwise subtraction between two matrices.

__lt__(other: LMatrix3f) bool
__mul__(other: LMatrix3f) LMatrix3f
__mul__(scalar: float) LMatrix3f
__ne__(other: LMatrix3f) bool
__reduce__() object
__repr__() str
addHash(hash: int) int

Adds the vector into the running hash.

addHash(hash: int, threshold: float) int

Adds the vector into the running hash.

almostEqual(other: LMatrix3f) bool

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

almostEqual(other: LMatrix3f, threshold: float) bool

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

assign(other: LMatrix3f) LMatrix3f
assign(fill_value: float) LMatrix3f
property cols Sequence[LVecBase3f]
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.

compareTo(other: LMatrix3f) int

This flavor of compareTo() uses a default threshold value based on the numeric type.

compareTo(other: LMatrix3f, 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).

componentwiseMult(other: LMatrix3f)
static convertMat(from: CoordinateSystem, to: CoordinateSystem) LMatrix3f

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.

generateHash(hashgen: ChecksumHashGenerator)

Adds the vector to the indicated hash generator.

generateHash(hashgen: ChecksumHashGenerator, threshold: float)

Adds the vector to the indicated hash generator.

getCell(row: int, col: int) float

Returns a particular element of the matrix.

static getClassType() TypeHandle
getCol(col: int) LVecBase3f

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

getCol2(col: int) LVecBase2f

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

getCol2s() list
getCols() list
getData()

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

Returns a suitable hash for phash_map.

getHash(threshold: float) int

Returns a suitable hash for phash_map.

getNumComponents() int

Returns the number of elements in the matrix, nine.

getRow(result_vec: LVecBase3f, row: int)

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

getRow(row: int) LVecBase3f

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

getRow2(row: int) LVecBase2f

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

getRow2s() list
getRows() list
static identMat() LMatrix3f

Returns an identity matrix.

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

invertFrom(other: LMatrix3f) 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 invertInPlace().

The return value is true if the matrix was successfully inverted, false if there was a singularity.

invertInPlace() bool

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

invertTransposeFrom(other: LMatrix3f) bool

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

invertTransposeFrom(other: LMatrix4f) bool

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

isIdentity() bool

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

isNan() bool

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

multiply(other1: LMatrix3f, other2: LMatrix3f)

this = other1 * other2

operatorNew(size: int)
output(out: ostream)
readDatagram(source: DatagramIterator)

Reads the matrix from the Datagram using get_stdfloat().

readDatagramFixed(scan: DatagramIterator)

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

static rotateMat(angle: float) LMatrix3f

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

static rotateMat(angle: float, axis: LVecBase3f, cs: CoordinateSystem) LMatrix3f

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

static rotateMatNormaxis(angle: float, axis: LVecBase3f, cs: CoordinateSystem) LMatrix3f

Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vector. Assumes axis has been normalized.

property rows Sequence[LVecBase3f]
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 scaleMat(scale: LVecBase2f) LMatrix3f

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

static scaleMat(scale: LVecBase3f) LMatrix3f

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

static scaleMat(sx: float, sy: float) LMatrix3f

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

static scaleMat(sx: float, sy: float, sz: float) LMatrix3f

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

static scaleShearMat(scale: LVecBase3f, shear: LVecBase3f, cs: CoordinateSystem) LMatrix3f

Returns a matrix that applies the indicated scale and shear.

static scaleShearMat(sx: float, sy: float, sz: float, shxy: float, shxz: float, shyz: float, cs: CoordinateSystem) LMatrix3f

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)
setCell(row: int, col: int, value: float)

Changes a particular element of the matrix.

setCol(col: int, v: LVecBase2f)

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

setCol(col: int, v: LVecBase3f)

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

setRotateMat(angle: float)

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

setRotateMat(angle: float, axis: LVecBase3f, cs: CoordinateSystem)

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

setRotateMatNormaxis(angle: float, axis: LVecBase3f, 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.

setRow(row: int, v: LVecBase2f)

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

setRow(row: int, v: LVecBase3f)

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

setScaleMat(scale: LVecBase2f)

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

setScaleMat(scale: LVecBase3f)

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

setScaleShearMat(scale: LVecBase3f, shear: LVecBase3f, cs: CoordinateSystem)

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

setShearMat(shear: LVecBase3f, cs: CoordinateSystem)

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

setTranslateMat(trans: LVecBase2f)

Fills mat with a matrix that applies the indicated translation.

static shearMat(shear: LVecBase3f, cs: CoordinateSystem) LMatrix3f

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

static shearMat(shxy: float, shxz: float, shyz: float, cs: CoordinateSystem) LMatrix3f

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 translateMat(trans: LVecBase2f) LMatrix3f

Returns a matrix that applies the indicated translation.

static translateMat(tx: float, ty: float) LMatrix3f

Returns a matrix that applies the indicated translation.

transposeFrom(other: LMatrix3f)
transposeInPlace()
write(out: ostream, indent_level: int)
writeDatagram(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.

writeDatagramFixed(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.setStdfloatDouble(). 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: LVecBase3f) LVecBase3f

3-component vector or point times matrix.

xformInPlace(v: LVecBase3f)

3-component vector or point times matrix.

xformPoint(v: LVecBase2f) LVecBase2f

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

xformPointInPlace(v: LVecBase2f)

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

xformVec(v: LVecBase2f) LVecBase2f

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

xformVec(v: LVecBase3f) LVecBase3f

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

xformVecGeneral(v: LVecBase3f) LVecBase3f

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

xformVecGeneralInPlace(v: LVecBase3f)

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

xformVecInPlace(v: LVecBase2f)

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

xformVecInPlace(v: LVecBase3f)

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

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