# EggTransform¶

from panda3d.egg import EggTransform

class EggTransform

This represents the <Transform> entry of a group or texture node: a list of component transform operations, applied in order, that describe a net transform matrix.

This may be either a 3-d transform, and therefore described by a 4x4 matrix, or a 2-d transform, described by a 3x3 matrix.

Inheritance diagram

enum ComponentType
enumerator CT_invalid = 0
enumerator CT_translate2d = 1
enumerator CT_translate3d = 2
enumerator CT_rotate2d = 3
enumerator CT_rotx = 4
enumerator CT_roty = 5
enumerator CT_rotz = 6
enumerator CT_rotate3d = 7
enumerator CT_scale2d = 8
enumerator CT_scale3d = 9
enumerator CT_uniform_scale = 10
enumerator CT_matrix3 = 11
enumerator CT_matrix4 = 12
__init__()
__init__(copy: EggTransform)
addMatrix3(mat: panda3d.core.LMatrix3d)None

Appends an arbitrary 3x3 matrix to the current transform.

addMatrix4(mat: panda3d.core.LMatrix4d)None

Appends an arbitrary 4x4 matrix to the current transform.

addRotate2d(angle: float)None

Appends a 2-d rotation to the current transform. The rotation angle is specified in degrees counterclockwise about the origin.

addRotate3d(quat: panda3d.core.LQuaterniond)None

Appends an arbitrary 3-d rotation to the current transform, expressed as a quaternion. This is converted to axis-angle notation for the egg file.

addRotate3d(angle: float, axis: panda3d.core.LVector3d)None

Appends a 3-d rotation about an arbitrary axis to the current transform. The rotation angle is specified in degrees counterclockwise about the axis.

addRotx(angle: float)None

Appends a rotation about the X axis to the current transform. The rotation angle is specified in degrees counterclockwise about the axis.

addRoty(angle: float)None

Appends a rotation about the Y axis to the current transform. The rotation angle is specified in degrees counterclockwise about the axis.

addRotz(angle: float)None

Appends a rotation about the Z axis to the current transform. The rotation angle is specified in degrees counterclockwise about the axis.

addScale2d(scale: panda3d.core.LVecBase2d)None

Appends a possibly non-uniform scale to the current transform.

addScale3d(scale: panda3d.core.LVecBase3d)None

Appends a possibly non-uniform scale to the current transform.

addTranslate2d(translate: panda3d.core.LVector2d)None

Appends a 2-d translation operation to the current transform.

addTranslate3d(translate: panda3d.core.LVector3d)None

Appends a 3-d translation operation to the current transform.

addUniformScale(scale: float)None

Appends a uniform scale to the current transform.

assign(copy: EggTransform)EggTransform
clearTransform()None

Resets the transform to empty, identity.

getComponentMat3(n: int)panda3d.core.LMatrix3d

Returns the 3x3 matrix associated with the nth component. It is an error to call this if the component type is not CT_matrix3.

getComponentMat4(n: int)panda3d.core.LMatrix4d

Returns the 4x4 matrix associated with the nth component. It is an error to call this if the component type is not CT_matrix4.

getComponentNumber(n: int)float

Returns the solitary number associated with the nth component. In the case of a rotation, this is the angle in degrees to rotate; in the case of uniform scale, this is the amount of the scale. Other types do not use this property.

getComponentType(n: int) → ComponentType

Returns the type of the nth component.

getComponentVec2(n: int)panda3d.core.LVecBase2d

Returns the 2-component vector associated with the nth component. This may be the translate vector, rotate axis, or non-uniform scale. It is an error to call this if the component type does not use a 2-d vector property.

getComponentVec3(n: int)panda3d.core.LVecBase3d

Returns the 3-component vector associated with the nth component. This may be the translate vector, rotate axis, or non-uniform scale. It is an error to call this if the component type does not use a 3-d vector property.

getNumComponents()int

Returns the number of components that make up the transform.

getTransform2d()panda3d.core.LMatrix3d

Returns the overall transform as a 3x3 matrix. It is an error to call this if hasTransform3d() is true.

getTransform3d()panda3d.core.LMatrix4d

Returns the overall transform as a 4x4 matrix. It is valid to call this even if hasTransform2d() is true; in this case, the 3x3 transform will be expanded to a 4x4 matrix.

hasTransform()bool

Returns true if the transform is nonempty, false if it is empty (no transform components have been added). This is true for either a 2-d or a 3-d transform.

hasTransform2d()bool

Returns true if the transform is specified as a 2-d transform, e.g. with a 3x3 matrix, or false if it is specified as a 3-d transform (with a 4x4 matrix), or not specified at all.

Normally, EggTextures have a 2-d matrix (but occasionally they use a 3-d matrix), and EggGroups always have a 3-d matrix.

hasTransform3d()bool

Returns true if the transform is specified as a 3-d transform, e.g. with a 4x4 matrix, or false if it is specified as a 2-d transform (with a 2x2 matrix), or not specified at all.

Normally, EggTextures have a 3-d matrix (but occasionally they use a 3-d matrix), and EggGroups always have a 3-d matrix.

setTransform2d(mat: panda3d.core.LMatrix3d)None

Sets the overall transform as a 3x3 matrix. This completely replaces whatever componentwise transform may have been defined.

setTransform3d(mat: panda3d.core.LMatrix4d)None

Sets the overall transform as a 4x4 matrix. This completely replaces whatever componentwise transform may have been defined.

transformIsIdentity()bool

Returns true if the described transform is identity, false otherwise.

write(out: panda3d.core.ostream, indent_level: int, label: str)None

Writes the transform to the indicated stream in Egg format.