Workspace 6.21.5
Public Member Functions | List of all members
TransformGroup Class Reference

Object group defining an arbitrary 3D transformation. More...

#include <Mesh/Geometry/transformgroup.h>

Inheritance diagram for TransformGroup:
[legend]

Public Member Functions

 TransformGroup ()
 
 TransformGroup (const TransformGroup &v)
 
 TransformGroup (const TransformMatrix &matrix)
 
 ~TransformGroup () override
 
TransformGroupclone () const override
 
Vector3d getEulerAngles () const
 
Vector3d getScaleFactors () const
 
Vector3d getShear () const
 
Vector3d getTranslation () const
 
TransformGroupoperator= (const TransformGroup &v)
 
TransformGroupoperator= (const TransformMatrix &matrix)
 
bool operator== (const TransformGroup &g) const
 
void setEulerAngles (const Vector3d &angles)
 
void setScaleFactors (const Vector3d &factors)
 
void setShear (const Vector3d &shear)
 
void setTranslation (const Vector3d &trans)
 
- Public Member Functions inherited from ObjectGroup
 ~ObjectGroup () override
 
bool add (const QString &name, DataObject &obj)
 
bool canSerialize () const override
 
ObjectGroupclone () const override=0
 
bool empty () const
 
void ensureGroupHasData ()
 
void erase (int index)
 
DataObjectgetChild (const QString &name)
 
const DataObjectgetChild (const QString &name) const
 
DataObjectgetDataObject (int index)
 
const DataObjectgetDataObject (int index) const
 
int getIndex (const QString &name) const
 
const QString & getName (int index) const
 
virtual QString getPreferedWidget (const QString &name) const
 
bool hasData () const
 
bool haveName (const QString &name) const
 
bool insert (const QString &name, DataObject &obj, int index=-1)
 
bool load (const QJsonDocument &doc)
 
bool load (const SerializedItem &item) override
 
bool save (QJsonDocument &doc) const
 
bool save (SerializedItem &item) const override
 
unsigned size () const
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 
- Public Member Functions inherited from Serialize
virtual ~Serialize ()=default
 
virtual bool canSerialize () const =0
 
virtual bool load (const SerializedItem &item)=0
 
virtual bool save (SerializedItem &item) const =0
 

Additional Inherited Members

- Protected Member Functions inherited from ObjectGroup
 ObjectGroup ()
 
void clear ()
 
ObjectGroupoperator= (const ObjectGroup &rhs)
 
bool operator== (const ObjectGroup &rhs) const
 
void swap (ObjectGroup &rhs)
 

Detailed Description

There are four components to the transform: shear, scale, rotation and translation, and they are applied in that order. See the details of the TransformMatrix class for the mathematics behind how transforms are generally used.

The TransformGroup class exists to provide a more user-friendly way of defining transforms than the raw mathematical nature of TransformMatrix. TransformGroup is not meant to be computationally efficient, but rather it is best suited to operation inputs and outputs where the operations are computationally intensive or where performance is not so critical. The usual approach is to pass around TransformGroup between workspace operations and then convert it internally into a TransformMatrix for the operation itself to use in computational tasks.

Constructor & Destructor Documentation

◆ TransformGroup() [1/3]

Creates the transform as the identity matrix (ie no transform at all).

◆ TransformGroup() [2/3]

Parameters
vThe transform to copy.

◆ TransformGroup() [3/3]

TransformGroup ( const TransformMatrix matrix)
Parameters
matrixThe transform matrix to be used to construct the initial values of the group. It must be invertible.

◆ ~TransformGroup()

~TransformGroup ( )
override

Member Function Documentation

◆ clone()

TransformGroup * clone ( ) const
overridevirtual
Returns
A clone of this object.
Note
Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.

We redeclare this function only so that the more derived return type is available without casting.

Implements ObjectGroup.

◆ getEulerAngles()

Vector3d getEulerAngles ( ) const
Returns
The euler angles for the transform.
See also
setEulerAngles()

◆ getScaleFactors()

Vector3d getScaleFactors ( ) const
Returns
The scale factors for the transform.
See also
setScaleFactors()

◆ getShear()

Vector3d getShear ( ) const
Returns
The shear for the transform.
Warning
Support for shear is relatively incomplete. It will often be completely ignored by classes and functions.
See also
setShear()

◆ getTranslation()

Vector3d getTranslation ( ) const
Returns
The translation for the transform.
See also
setTranslation()

◆ operator=() [1/2]

TransformGroup & operator= ( const TransformGroup v)
Parameters
vThe transform to assign to this object.
Returns
This object.

◆ operator=() [2/2]

TransformGroup & operator= ( const TransformMatrix matrix)
Parameters
matrixThe transform matrix to be used to work out the values for the group. It must be invertible.
Returns
This object.

◆ operator==()

bool operator== ( const TransformGroup g) const
Parameters
gThe transform to compare with.
Returns
True if the two groups are identical. Note that since floating point values are involved, it is highly unlikely that two transforms will be identical if any calculation was involved with setting any of their values. Two transforms will likely only be identical if they were assigned from the same source or one assigned from the other.

◆ setEulerAngles()

void setEulerAngles ( const Vector3d angles)
Parameters
anglesThe euler angles to use for the transform. Ordering is about the Z axis first, then about the Y axis and lastly about the X axis.

All rotation occurs about the origin. If you need to rotate about some other point, you need to apply a separate transform first before rotating, then the inverse of that transform again after rotating.

◆ setScaleFactors()

void setScaleFactors ( const Vector3d factors)
Parameters
factorsThe scale factor for each axis direction. A factor of 1 effectively indicates no scaling. Negative values imply reflection about an axis.

All scaling occurs about the origin. If you need to scale about some other point, you need to apply a separate transform first before scaling, then the inverse of that transform again after scaling.

◆ setShear()

void setShear ( const Vector3d shear)
Parameters
shearThe shear coefficients.
Warning
Support for shear is relatively incomplete. It will often be completely ignored by classes and functions.

◆ setTranslation()

void setTranslation ( const Vector3d trans)
Parameters
transThe translation to apply for the transform.