Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

EggTransform3d Class Reference

This represents the entry of a group node: a list of component transform operations, applied in order, that describe a net transform matrix. More...

#include <eggTransform3d.h>

Inheritance diagram for EggTransform3d:

EggGroup EggBin List of all members.

Public Types

enum  ComponentType {
  CT_invalid, CT_translate, CT_rotx, CT_roty,
  CT_rotz, CT_rotate, CT_scale, CT_uniform_scale,
  CT_matrix
}

Public Member Functions

 EggTransform3d ()
 EggTransform3d (const EggTransform3d &copy)
EggTransform3d & operator= (const EggTransform3d &copy)
virtual ~EggTransform3d ()
void clear_transform ()
 Resets the transform to empty, identity.

void add_translate (const LVector3d &translate)
 Appends a translation operation to the current transform.

void add_rotx (double angle)
 Appends a rotation about the X axis to the current transform.

void add_roty (double angle)
 Appends a rotation about the Y axis to the current transform.

void add_rotz (double angle)
 Appends a rotation about the Z axis to the current transform.

void add_rotate (double angle, const LVector3d &axis)
 Appends a rotation about an arbitrary axis to the current transform.

void add_rotate (const LQuaterniond &quat)
 Appends an arbitrary rotation to the current transform, expressed as a quaternion.

void add_scale (const LVecBase3d &scale)
 Appends a possibly non-uniform scale to the current transform.

void add_uniform_scale (double scale)
 Appends a uniform scale to the current transform.

void add_matrix (const LMatrix4d &mat)
 Appends an arbitrary 4x4 matrix to the current transform.

bool has_transform () const
 Returns true if the transform is nonempty, false if it is empty (no transform components have been added).

void set_transform (const LMatrix4d &mat)
 Sets the overall transform as a 4x4 matrix.

const LMatrix4d & get_transform () const
 Returns the overall transform as a 4x4 matrix.

bool transform_is_identity () const
 Returns true if the described transform is identity, false otherwise.

int get_num_components () const
 Returns the number of components that make up the transform.

ComponentType get_component_type (int n) const
 Returns the type of the nth component.

double get_component_number (int n) const
 Returns the solitary number associated with the nth component.

const LVector3d & get_component_vector (int n) const
 Returns the 3-component vector associated with the nth component.

const LMatrix4d & get_component_matrix (int n) const
 Returns the 4x4 matrix associated with the nth component.

void write (ostream &out, int indent_level) const
 Writes the transform to the indicated stream in Egg format.


Protected Member Functions

void internal_clear_transform ()
 Resets the transform to empty without calling transform_changed().

void internal_add_matrix (const LMatrix4d &mat)
 Appends an arbitrary 4x4 matrix to the current transform, without calling transform_changed().

void internal_set_transform (const LMatrix4d &mat)
 Sets the overall transform without calling transform_changed().

virtual void transform_changed ()
 This virtual method is called whenever the transform is changed; it is intended to provide a hook for derived classes (e.g.


Private Types

typedef pvector< ComponentComponents

Private Attributes

Components _components
LMatrix4d _transform

Detailed Description

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

This is a 3-d transform, and therefore computes a 4x4 matrix.

Definition at line 43 of file eggTransform3d.h.


Member Typedef Documentation

typedef pvector<Component> EggTransform3d::Components [private]
 

Definition at line 108 of file eggTransform3d.h.


Member Enumeration Documentation

enum EggTransform3d::ComponentType
 

Enumeration values:
CT_invalid 
CT_translate 
CT_rotx 
CT_roty 
CT_rotz 
CT_rotate 
CT_scale 
CT_uniform_scale 
CT_matrix 

Definition at line 67 of file eggTransform3d.h.


Constructor & Destructor Documentation

EggTransform3d::EggTransform3d  ) 
 

Definition at line 33 of file eggTransform3d.cxx.

EggTransform3d::EggTransform3d const EggTransform3d &  copy  ) 
 

Definition at line 46 of file eggTransform3d.cxx.

References _components, and _transform.

EggTransform3d::~EggTransform3d  )  [virtual]
 

Definition at line 74 of file eggTransform3d.cxx.

References _components, and _transform.


Member Function Documentation

void EggTransform3d::add_matrix const LMatrix4d &  mat  )  [inline]
 

Appends an arbitrary 4x4 matrix to the current transform.

Definition at line 133 of file eggTransform3d.I.

References INLINE, internal_set_transform(), and transform_changed().

void EggTransform3d::add_rotate const LQuaterniond &  quat  ) 
 

Appends an arbitrary rotation to the current transform, expressed as a quaternion.

This is converted to axis-angle notation for the egg file.

Definition at line 186 of file eggTransform3d.cxx.

References CT_rotx, CT_roty, and CT_translate.

void EggTransform3d::add_rotate double  angle,
const LVector3d &  axis
 

Appends a rotation about an arbitrary axis to the current transform.

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

Definition at line 165 of file eggTransform3d.cxx.

References _components, _transform, CT_uniform_scale, and transform_changed().

Referenced by add_rotz().

void EggTransform3d::add_rotx double  angle  ) 
 

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

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

Definition at line 108 of file eggTransform3d.cxx.

References _components, _transform, CT_rotz, and transform_changed().

void EggTransform3d::add_roty double  angle  ) 
 

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

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

Definition at line 127 of file eggTransform3d.cxx.

References _components, _transform, CT_rotate, and transform_changed().

void EggTransform3d::add_rotz double  angle  ) 
 

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

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

Definition at line 146 of file eggTransform3d.cxx.

References add_rotate(), and transform_changed().

void EggTransform3d::add_scale const LVecBase3d &  scale  ) 
 

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

Definition at line 202 of file eggTransform3d.cxx.

References CT_rotate, CT_rotz, and CT_scale.

void EggTransform3d::add_translate const LVector3d &  translate  ) 
 

Appends a translation operation to the current transform.

Definition at line 88 of file eggTransform3d.cxx.

References _components, _transform, CT_rotx, and transform_changed().

void EggTransform3d::add_uniform_scale double  scale  ) 
 

Appends a uniform scale to the current transform.

Definition at line 218 of file eggTransform3d.cxx.

References CT_invalid, CT_matrix, and CT_uniform_scale.

void EggTransform3d::clear_transform  )  [inline]
 

Resets the transform to empty, identity.

Definition at line 117 of file eggTransform3d.I.

References _components, and INLINE.

const LMatrix4d & EggTransform3d::get_component_matrix int  n  )  const [inline]
 

Returns the 4x4 matrix associated with the nth component.

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

Definition at line 289 of file eggTransform3d.I.

double EggTransform3d::get_component_number int  n  )  const [inline]
 

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.

Definition at line 248 of file eggTransform3d.I.

EggTransform3d::ComponentType EggTransform3d::get_component_type int  n  )  const [inline]
 

Returns the type of the nth component.

Definition at line 226 of file eggTransform3d.I.

References _components.

const LVector3d & EggTransform3d::get_component_vector int  n  )  const [inline]
 

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 vector property.

Definition at line 270 of file eggTransform3d.I.

int EggTransform3d::get_num_components  )  const [inline]
 

Returns the number of components that make up the transform.

Definition at line 213 of file eggTransform3d.I.

References _components.

const LMatrix4d & EggTransform3d::get_transform  )  const [inline]
 

Returns the overall transform as a 4x4 matrix.

Definition at line 182 of file eggTransform3d.I.

References _components.

Referenced by CharacterMaker::make_bundle(), and EggGroup::string_collide_flags().

bool EggTransform3d::has_transform  )  const [inline]
 

Returns true if the transform is nonempty, false if it is empty (no transform components have been added).

Definition at line 151 of file eggTransform3d.I.

References _components, _transform, and INLINE.

void EggTransform3d::internal_add_matrix const LMatrix4d &  mat  )  [protected]
 

Appends an arbitrary 4x4 matrix to the current transform, without calling transform_changed().

Definition at line 319 of file eggTransform3d.cxx.

void EggTransform3d::internal_clear_transform  )  [protected]
 

Resets the transform to empty without calling transform_changed().

Definition at line 303 of file eggTransform3d.cxx.

Referenced by EggTransform3d::Component::~Component().

void EggTransform3d::internal_set_transform const LMatrix4d &  mat  )  [inline, protected]
 

Sets the overall transform without calling transform_changed().

Definition at line 306 of file eggTransform3d.I.

Referenced by add_matrix().

EggTransform3d & EggTransform3d::operator= const EggTransform3d &  copy  ) 
 

Definition at line 60 of file eggTransform3d.cxx.

Referenced by EggGroup::EggGroup().

void EggTransform3d::set_transform const LMatrix4d &  mat  )  [inline]
 

Sets the overall transform as a 4x4 matrix.

This completely replaces whatever componentwise transform may have been defined.

Definition at line 168 of file eggTransform3d.I.

References _components, and INLINE.

void EggTransform3d::transform_changed  )  [protected, virtual]
 

This virtual method is called whenever the transform is changed; it is intended to provide a hook for derived classes (e.g.

EggGroup) to update their internal cache appropriately.

Reimplemented in EggGroup.

Definition at line 340 of file eggTransform3d.cxx.

Referenced by add_matrix(), add_rotate(), add_rotx(), add_roty(), add_rotz(), add_translate(), and EggTransform3d::Component::~Component().

bool EggTransform3d::transform_is_identity  )  const [inline]
 

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

Definition at line 197 of file eggTransform3d.I.

References _components.

void EggTransform3d::write ostream &  out,
int  indent_level
const
 

Writes the transform to the indicated stream in Egg format.

Reimplemented in EggGroup.

Definition at line 235 of file eggTransform3d.cxx.


Member Data Documentation

Components EggTransform3d::_components [private]
 

Definition at line 109 of file eggTransform3d.h.

Referenced by add_rotate(), add_rotx(), add_roty(), add_translate(), clear_transform(), EggTransform3d(), get_component_type(), get_num_components(), get_transform(), has_transform(), set_transform(), transform_is_identity(), and ~EggTransform3d().

LMatrix4d EggTransform3d::_transform [private]
 

Definition at line 110 of file eggTransform3d.h.

Referenced by add_rotate(), add_rotx(), add_roty(), add_translate(), EggTransform3d(), has_transform(), and ~EggTransform3d().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:50:28 2003 for Panda by doxygen1.3