Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions

# EggTransform Class Reference

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. More...

Inheritance diagram for EggTransform:

List of all members.

## Public Types
enum | ComponentType { CTInvalid = 0, CTTranslate2d = 1, CTTranslate3d = 2, CTRotate2d = 3, CTRotx = 4, CTRoty = 5, CTRotz = 6, CTRotate3d = 7, CTScale2d = 8, CTScale3d = 9, CTUniformScale = 10, CTMatrix3 = 11, CTMatrix4 = 12 }
## Public Member Functions
| EggTransform ()
| EggTransform (EggTransform const copy)
| addMatrix3 (Mat3D const mat)
| Appends an arbitrary 3x3 matrix to the current transform.
| addMatrix4 (Mat4D const mat)
| Appends an arbitrary 4x4 matrix to the current transform.
| addRotate2d (double angle)
| Appends a 2-d rotation to the current transform.
| addRotate3d (QuatD const quat)
| Appends an arbitrary 3-d rotation to the current transform, expressed as a quaternion.
| addRotate3d (double angle, Vec3D const axis)
| Appends a 3-d rotation about an arbitrary axis to the current transform.
| addRotx (double angle)
| Appends a rotation about the X axis to the current transform.
| addRoty (double angle)
| Appends a rotation about the Y axis to the current transform.
| addRotz (double angle)
| Appends a rotation about the Z axis to the current transform.
| addScale2d (VBase2D const scale)
| Appends a possibly non-uniform scale to the current transform.
| addScale3d (VBase3D const scale)
| Appends a possibly non-uniform scale to the current transform.
| addTranslate2d (Vec2D const translate)
| Appends a 2-d translation operation to the current transform.
| addTranslate3d (Vec3D const translate)
| Appends a 3-d translation operation to the current transform.
| addUniformScale (double scale)
| Appends a uniform scale to the current transform.
| clearTransform ()
| Resets the transform to empty, identity.
Mat3D const | getComponentMat3 (int n)
| Returns the 3x3 matrix associated with the nth component.
Mat4D const | getComponentMat4 (int n)
| Returns the 4x4 matrix associated with the nth component.
double | getComponentNumber (int n)
| Returns the solitary number associated with the nth component.
ComponentType | getComponentType (int n)
| Returns the type of the nth component.
VBase2D const | getComponentVec2 (int n)
| Returns the 2-component vector associated with the nth component.
VBase3D const | getComponentVec3 (int n)
| Returns the 3-component vector associated with the nth component.
int | getNumComponents ()
| Returns the number of components that make up the transform.
Mat3D | getTransform2d ()
| Returns the overall transform as a 3x3 matrix.
Mat4D const | getTransform3d ()
| Returns the overall transform as a 4x4 matrix.
bool | hasTransform ()
| Returns true if the transform is nonempty, false if it is empty (no transform components have been added).
bool | hasTransform2d ()
| Returns true if the transform is specified as a 2-d transform, e.g.
bool | hasTransform3d ()
| Returns true if the transform is specified as a 3-d transform, e.g.
EggTransform | operator= (EggTransform const copy)
| setTransform2d (Mat3D const mat)
| Sets the overall transform as a 3x3 matrix.
| setTransform3d (Mat4D const mat)
| Sets the overall transform as a 4x4 matrix.
bool | transformIsIdentity ()
| Returns true if the described transform is identity, false otherwise.
| write (ostream out, int indent_level, string label)
| Writes the transform to the indicated stream in Egg format.

## Detailed Description

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.

## Member Enumeration Documentation

enum ComponentType

Enumerator:

  CTInvalid |
  CTTranslate2d |
  CTTranslate3d |
  CTRotate2d |
  CTRotx |
  CTRoty |
  CTRotz |
  CTRotate3d |
  CTScale2d |
  CTScale3d |
  CTUniformScale |
  CTMatrix3 |
  CTMatrix4 |

## Constructor & Destructor Documentation

EggTransform | ( |  | ) |

EggTransform | ( | EggTransform const | copy | ) |

## Member Function Documentation

addMatrix3 | ( | Mat3D const | mat | ) |

Appends an arbitrary 3x3 matrix to the current transform.

addMatrix4 | ( | Mat4D const | mat | ) |

Appends an arbitrary 4x4 matrix to the current transform.

addRotate2d | ( | double | angle | ) |

Appends a 2-d rotation to the current transform.

The rotation angle is specified in degrees counterclockwise about the origin.

addRotate3d | ( | QuatD const | quat | ) |

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 | ( | double | angle,
|  | Vec3D const | axis
| ) |  |

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 | ( | double | angle | ) |

Appends a rotation about the X axis to the current transform.

The rotation angle is specified in degrees counterclockwise about the axis.

addRoty | ( | double | angle | ) |

Appends a rotation about the Y axis to the current transform.

The rotation angle is specified in degrees counterclockwise about the axis.

addRotz | ( | double | angle | ) |

Appends a rotation about the Z axis to the current transform.

The rotation angle is specified in degrees counterclockwise about the axis.

addScale2d | ( | VBase2D const | scale | ) |

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

addScale3d | ( | VBase3D const | scale | ) |

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

addTranslate2d | ( | Vec2D const | translate | ) |

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

addTranslate3d | ( | Vec3D const | translate | ) |

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

addUniformScale | ( | double | scale | ) |

Appends a uniform scale to the current transform.

clearTransform | ( |  | ) |

Resets the transform to empty, identity.

Mat3D const getComponentMat3 | ( | int | n | ) |

Returns the 3x3 matrix associated with the nth component.

It is an error to call this if the component type is not CT_matrix3.

Mat4D const getComponentMat4 | ( | int | n | ) |

Returns the 4x4 matrix associated with the nth component.

It is an error to call this if the component type is not CT_matrix4.

double getComponentNumber | ( | int | n | ) |

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.

ComponentType getComponentType | ( | int | n | ) |

Returns the type of the nth component.

VBase2D const getComponentVec2 | ( | int | n | ) |

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.

VBase3D const getComponentVec3 | ( | int | n | ) |

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.

int getNumComponents | ( |  | ) |

Returns the number of components that make up the transform.

Mat3D getTransform2d | ( |  | ) |

Returns the overall transform as a 3x3 matrix.

It is an error to call this if has_transform3d() is true.

Mat4D const getTransform3d | ( |  | ) |

Returns the overall transform as a 4x4 matrix.

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

bool hasTransform | ( |  | ) |

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.

bool hasTransform2d | ( |  | ) |

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.

bool hasTransform3d | ( |  | ) |

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.

EggTransform operator= | ( | EggTransform const | copy | ) |

setTransform2d | ( | Mat3D const | mat | ) |

Sets the overall transform as a 3x3 matrix.

This completely replaces whatever componentwise transform may have been defined.

setTransform3d | ( | Mat4D const | mat | ) |

Sets the overall transform as a 4x4 matrix.

This completely replaces whatever componentwise transform may have been defined.

bool transformIsIdentity | ( |  | ) |

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

write | ( | ostream | out,
|  | int | indent_level,
|  | string | label
| ) |  |

Writes the transform to the indicated stream in Egg format.

All Classes Namespaces Functions Variables Enumerations Enumerator Properties