ALBA
|
#include <albaTransform.h>
Classes | |
struct | mmuAffineParts |
struct | mmuQuat |
Public Types | |
enum | { CUSTOM = 0 , GLOBAL , PARENT , LOCAL , VIEW } |
enum | mmuQuatPart { X , Y , Z , W } |
typedef mmuQuat | HVect |
typedef double | HMatrix[4][4] |
Public Member Functions | |
albaTransform () | |
~albaTransform () | |
albaTransform (const albaTransform &) | |
albaTypeMacro (albaTransform, albaTransformBase) | |
virtual void | SetMatrix (const albaMatrix &input) |
void | SetMatrixPointer (albaMatrix *matrix) |
double | PolarDecomp (albaMatrix &Q, albaMatrix &S, double translation[3]) |
void | Identity () |
void | Invert () |
void | GetOrientation (double orientation[3]) |
void | GetOrientation (float orient[3]) |
void | GetOrientationWXYZ (double wxyz[4]) |
void | GetOrientationWXYZ (float wxyz[3]) |
void | GetPosition (double position[3]) |
void | GetPosition (float position[3]) |
void | SetPosition (double position[3]) |
void | SetPosition (double x, double y, double z) |
void | Translate (double translation[3], int premultiply) |
void | Translate (double x, double y, double z, int premultiply) |
void | RotateWXYZ (double angle, double x, double y, double z, int premultiply) |
void | RotateWXYZ (double angle, double rot[3], int premultiply) |
void | RotateX (double angle, int premultiply) |
void | RotateY (double angle, int premultiply) |
void | RotateZ (double angle, int premultiply) |
void | Concatenate (const albaMatrix &matrix, int premultiply) |
void | Concatenate (albaTransformBase *trans, int premultiply) |
void | SetOrientation (double orientation[3]) |
void | SetOrientation (double rx, double ry, double rz) |
void | GetScale (double scale[3]) |
void | GetScale (float scale[3]) |
void | Scale (double scalex, double scaley, double scalez, int premultiply) |
void | GetVersor (int axis, double versor[3]) |
void | GetVersor (int axis, float versor[3]) |
void | CopyRotation (const albaMatrix &source) |
void | CopyTranslation (const albaMatrix &source) |
int | MatrixToAttitudeVector (const albaMatrix &matrix, double attitude_vector[3]) |
int | MatrixToEulerCardanicAngle (const albaMatrix &matrix, int i, int j, int k, double euler_cardan[3], double tentative_euler_cardan_first, double tentative_euler_cardan_second, double tentative_euler_cardan_third) |
int | MatrixTommuQuaternion (const albaMatrix &matrix, double quaternion[4]) |
int | QuaternionToMatrix (double quaternion[4], albaMatrix &matrix) |
int | HelicalAxisToMatrix (double helical_axis[3], double angle, albaMatrix &matrix) |
int | AttitudeVectorToMatrix (double attitude_vector[3], albaMatrix &matrix) |
int | EulerCardanicAngleToMatrix (double euler_cardan[3], int i, int j, int k, albaMatrix &matrix) |
int | MatrixToHelicalAxis (const albaMatrix &matrix, double helical_axis[3], double point[3], double &phi, double &t, int intersect) |
Public Member Functions inherited from albaTransformBase | |
albaTransformBase () | |
~albaTransformBase () | |
albaTransformBase (const albaTransformBase &) | |
albaAbstractTypeMacro (albaTransformBase, albaReferenceCounted) | |
virtual void | Print (std::ostream &os, const int indent=0) const |
virtual const albaMatrix & | GetMatrix () |
albaMatrix * | GetMatrixPointer () |
void | TransformPoint (const float in[3], float out[3]) |
void | TransformPoint (const double in[3], double out[3]) |
void | TransformNormalAtPoint (const float point[3], const float in[3], float out[3]) |
void | TransformNormalAtPoint (const double point[3], const double in[3], double out[3]) |
void | TransformVectorAtPoint (const float point[3], const float in[3], float out[3]) |
void | TransformVectorAtPoint (const double point[3], const double in[3], double out[3]) |
virtual void | Update () |
void | Modified () |
virtual void | InternalTransformPoint (const double in[3], double out[3]) |
virtual void | InternalTransformPoint (const float in[3], float out[3]) |
virtual unsigned long | GetMTime () |
virtual unsigned long | GetUpdateTime () |
void | SetTimeStamp (albaTimeStamp t) |
albaTimeStamp | GetTimeStamp () |
Public Member Functions inherited from albaReferenceCounted | |
albaReferenceCounted () | |
virtual | ~albaReferenceCounted () |
albaAbstractTypeMacro (albaReferenceCounted, albaObject) | |
virtual void | Delete () |
void | Register (void *obj) |
virtual void | UnRegister (void *obj) |
int | GetReferenceCount () |
void | SetReferenceCount (int) |
Public Member Functions inherited from albaObject | |
albaObject () | |
virtual | ~albaObject () |
virtual void | Delete () |
virtual const char * | GetTypeName () const |
virtual bool | IsA (const char *type_name) const |
virtual bool | IsA (const albaTypeID &type_id) const |
virtual albaObject * | NewObjectInstance () const =0 |
virtual const albaTypeID & | GetTypeId () const |
virtual void | Print (std::ostream &os, const int indent=0) const |
albaObject (const albaObject &c) | |
Public Member Functions inherited from albaEventBroadcaster | |
albaEventBroadcaster (void *owner=NULL) | |
virtual | ~albaEventBroadcaster () |
albaEventBroadcaster (const albaEventBroadcaster &c) | |
void | AddObserver (albaObserver *obj) |
void | AddObserver (albaObserver &obj) |
albaObserverCallback * | AddObserverCallback (void(*f)(void *sender, albaID eid, void *clientdata, void *calldata)) |
bool | RemoveObserver (albaObserver *obj) |
void | RemoveAllObservers () |
bool | IsObserver (albaObserver *obj) |
bool | HasObservers () |
void | GetObservers (std::vector< albaObserver * > &olist) |
void | InvokeEvent (albaEventBase &e) |
void | InvokeEvent (albaEventBase *e) |
void | InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL) |
void | SetChannel (albaID ch) |
albaID | GetChannel () |
virtual void | SetListener (albaObserver *o) |
Public Member Functions inherited from albaEventSender | |
albaEventSender () | |
virtual void | SetListener (albaObserver *o) |
virtual albaObserver * | GetListener () |
virtual bool | HasListener () |
virtual void | InvokeEvent (albaEventBase &e) |
virtual void | InvokeEvent (albaEventBase *e) |
virtual void | InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL) |
Static Public Member Functions | |
static double | PolarDecomp (const albaMatrix &M, albaMatrix &Q, albaMatrix &S, double translation[3]) |
static void | GetOrientation (const albaMatrix &in_matrix, double orientation[3]) |
static void | GetOrientation (const albaMatrix &in_matrix, float orientation[3]) |
static void | GetOrientationWXYZ (const albaMatrix &in_matrix, double wxyz[4]) |
static void | GetPosition (const albaMatrix &matrix, double position[3]) |
static void | GetPosition (const albaMatrix &matrix, float position[3]) |
static void | SetPosition (albaMatrix &matrix, double position[3]) |
static void | SetPosition (albaMatrix &matrix, double x, double y, double z) |
static void | Translate (albaMatrix &matrix, double translation[3], int premultiply) |
static void | Translate (albaMatrix &matrix, double x, double y, double z, int premultiply) |
static void | RotateWXYZ (const albaMatrix &source, albaMatrix &target, double angle, double x, double y, double z, int premultiply) |
static void | RotateX (albaMatrix &matrix, double angle, int premultiply) |
static void | RotateY (albaMatrix &matrix, double angle, int premultiply) |
static void | RotateZ (albaMatrix &matrix, double angle, int premultiply) |
static void | SetOrientation (albaMatrix &matrix, double orientation[3]) |
static void | SetOrientation (albaMatrix &matrix, double rx, double ry, double rz) |
static void | GetScale (const albaMatrix &matrix, double scale[3]) |
static void | Scale (albaMatrix &matrix, double scalex, double scaley, double scalez, int premultiply) |
static void | SetVersor (int axis, double versor[3], albaMatrix &matrix) |
static void | GetVersor (int axis, const albaMatrix &matrix, double versor[3]) |
static void | GetVersor (int axis, const albaMatrix &matrix, float versor[3]) |
static void | CopyRotation (const albaMatrix &source, albaMatrix &target) |
static void | CopyTranslation (const albaMatrix &source, albaMatrix &target) |
static void | AddVectors (double inV0[3], double inV1[3], double outSum[3]) |
static void | BuildVector (double *p1, double *p2, double *out_vector) |
static void | BuildVector (double coeff, const double *inVector, double *outVector, int refSysType=LOCAL, int localAxis=albaInteractorConstraint::X) |
static double | ProjectVectorOnAxis (const double *in_vector, const double *in_axis, double *out_projection=NULL) |
static double | ProjectVectorOnPlane (const double *in_vector, const double *in_plane_normal, double *out_projection=NULL) |
static void | FindPerpendicularVersors (double inVersorN[3], double outVersorP[3], double outVersorQ[3]) |
static void | MultiplyVectorByScalar (double s, double *vin, double *vout) |
static double | PolarDecomp (HMatrix M, HMatrix Q, HMatrix S) |
static void | DecompAffine (HMatrix A, mmuAffineParts *parts) |
static HVect | SpectDecomp (HMatrix S, HMatrix U) |
static mmuQuat | QuaternionFromMatrix (HMatrix mat) |
static void | InvertAffine (mmuAffineParts *parts, mmuAffineParts *inverse) |
static mmuQuat | Snuggle (mmuQuat q, HVect *k) |
Static Public Member Functions inherited from albaObject | |
static const char * | GetStaticTypeName () |
static bool | IsStaticType (const char *type_name) |
static bool | IsStaticType (const albaTypeID &type_id) |
static const albaTypeID & | GetStaticTypeId () |
static albaObject * | SafeDownCast (albaObject *o) |
Protected Member Functions | |
virtual void | InternalUpdate () |
virtual void | InternalUpdate ()=0 |
Additional Inherited Members | |
Protected Types inherited from albaEventBroadcaster | |
typedef std::list< albaObserver * > | albaObserversList |
Protected Attributes inherited from albaTransformBase | |
albaAutoPointer< albaMatrix > | m_Matrix |
albaMTime | m_MTime |
albaMTime | m_UpdateTime |
albaMutexLock | m_UpdateMutex |
albaTimeStamp | m_TimeStamp |
Protected Attributes inherited from albaReferenceCounted | |
int | m_ReferenceCount |
Protected Attributes inherited from albaObject | |
bool | m_HeapFlag |
Protected Attributes inherited from albaEventBroadcaster | |
albaObserversList | m_Observers |
albaID | m_Channel |
Protected Attributes inherited from albaEventSender | |
albaObserver * | m_Listener |
albaTransform - class for homogeneous transformations.
albaTransform provides functionalities for homogeneous transformations, including an algorithm for polar decomposition, used to keep the 3x3 sub matrix orthogonal. The idea of this class is to represent by itself a transformation, obtained by changing the an input transformation for its original coordinate system to a target coordinate system. Coordinate systems are by default the world coords system. Reference systems can be expressed as a albaTransformBase.
Definition at line 52 of file albaTransform.h.
typedef mmuQuat albaTransform::HVect |
Homogeneous 3D vector.
Definition at line 308 of file albaTransform.h.
typedef double albaTransform::HMatrix[4][4] |
Definition at line 318 of file albaTransform.h.
anonymous enum |
Enumerator | |
---|---|
CUSTOM | auxiliar ref sys |
GLOBAL | |
PARENT | |
LOCAL | the local ref sys of the VME |
VIEW | the view ref sys |
Definition at line 66 of file albaTransform.h.
Enumerator | |
---|---|
X | |
Y | |
Z | |
W |
Definition at line 305 of file albaTransform.h.
albaTransform::albaTransform | ( | ) |
albaTransform::~albaTransform | ( | ) |
albaTransform::albaTransform | ( | const albaTransform & | ) |
copy constructor
albaTransform::albaTypeMacro | ( | albaTransform | , |
albaTransformBase | |||
) |
RTTI stuff.
|
inlinevirtual |
Directly set the internal Matrix.
It's overwritten by Update if Input or InputFrame !=NULL This function makes a copy of the input matrix.
Definition at line 84 of file albaTransform.h.
References albaMatrix::GetTimeStamp(), albaTransformBase::Modified(), and albaTransformBase::SetTimeStamp().
void albaTransform::SetMatrixPointer | ( | albaMatrix * | matrix | ) |
set the internal matrix pointer to the given matrix.
Do not use this if you don't know what you are doing
|
static |
Polar Decomposition of matrix M in Q * S.
|
inline |
Definition at line 92 of file albaTransform.h.
References albaTransformBase::GetMatrix(), and PolarDecomp().
Referenced by PolarDecomp().
void albaTransform::Identity | ( | ) |
set internal matrix to Identity
void albaTransform::Invert | ( | ) |
Invert internal matrix.
|
static |
Get the x, y, z orientation angles from the transformation matrix as an array of three floating point values.
Copied from vtkTransform::GetOrientation()
|
static |
|
inline |
Definition at line 105 of file albaTransform.h.
References albaTransformBase::GetMatrix(), and GetOrientation().
Referenced by GetOrientation().
|
inline |
Definition at line 106 of file albaTransform.h.
|
static |
Return the wxyz angle+axis representing the current orientation.
Copied from vtkTransform::GetVTKOrientationWXYZ()
|
inline |
Definition at line 116 of file albaTransform.h.
References albaTransformBase::GetMatrix().
|
inline |
Definition at line 118 of file albaTransform.h.
|
static |
Return the position from the current transformation matrix as an array of three floating point numbers.
This is simply returning the translation component of the 4x4 matrix. Copied from vtkTransform::GetPosition()
|
static |
|
inline |
Definition at line 131 of file albaTransform.h.
References albaTransformBase::GetMatrix(), and GetPosition().
Referenced by GetPosition().
|
inline |
Definition at line 132 of file albaTransform.h.
|
static |
This function set the position column of the matrix.
Notice, the non static functions work on the internal matrix and can be used in conjuction with SetMatrix, but if a pipeline is defined (input, input_frame or target_frame) it's overwritten whenever the Update() is perfromed.
|
inline |
Definition at line 143 of file albaTransform.h.
References SetPosition().
Referenced by SetPosition().
|
inline |
Definition at line 144 of file albaTransform.h.
References SetPosition().
Referenced by SetPosition().
|
inlinestatic |
Definition at line 145 of file albaTransform.h.
|
static |
This function set the translation column of the matrix by adding the transaltion provided as argument.
Notice, the non static functions work on the internal matrix and can be used in conjuction with SetMatrix, but if a pipeline is defined (input, input_frame or target_frame) it's overwritten whenever the Update() is perfromed.
|
inline |
Definition at line 156 of file albaTransform.h.
References Translate().
Referenced by Translate().
|
inline |
Definition at line 157 of file albaTransform.h.
References Translate().
Referenced by Translate().
|
inlinestatic |
Definition at line 158 of file albaTransform.h.
|
static |
This function rotate the matrix around the specified axis.
Notice, the non static functions work on the internal matrix and can be used in conjuction with SetMatrix, but if a pipeline is defined (input, input_frame or target_frame) it's overwritten whenever the Update() is perfromed.
|
inline |
Definition at line 168 of file albaTransform.h.
References RotateWXYZ().
Referenced by RotateWXYZ().
|
inline |
Definition at line 169 of file albaTransform.h.
References RotateWXYZ().
Referenced by RotateWXYZ().
|
inlinestatic |
This functions rotate the internal matrix around the specified axis.
It can be used in conjuction with SetMatrix, but if a pipeline is defined (input, input_frame or target_frame) it's overwritten whenever the Update() is performed.
Definition at line 176 of file albaTransform.h.
References RotateWXYZ().
|
inlinestatic |
Definition at line 177 of file albaTransform.h.
References RotateWXYZ().
|
inlinestatic |
Definition at line 178 of file albaTransform.h.
References RotateWXYZ().
|
inline |
Definition at line 179 of file albaTransform.h.
References RotateX().
Referenced by RotateX().
|
inline |
Definition at line 180 of file albaTransform.h.
References RotateY().
Referenced by RotateY().
|
inline |
Definition at line 181 of file albaTransform.h.
References RotateZ().
Referenced by RotateZ().
void albaTransform::Concatenate | ( | const albaMatrix & | matrix, |
int | premultiply | ||
) |
Pre or Post multiply the internal matrix for given matrix and store result in the internal matrix.
|
inline |
Pre or Post multiply the internal matrix for given transform and store result in the internal matrix.
Definition at line 187 of file albaTransform.h.
References Concatenate(), and albaTransformBase::GetMatrix().
Referenced by Concatenate().
|
static |
This function set the orientation (acc.
to VTK convention) of the matrix. Notice, the non static functions work on the internal matrix and can be used in conjuction with SetMatrix, but if a pipeline is defined (input, input_frame or target_frame) it's overwritten whenever the Update() is performed.
|
inline |
Definition at line 194 of file albaTransform.h.
References SetOrientation().
Referenced by SetOrientation().
|
inline |
Definition at line 195 of file albaTransform.h.
References SetOrientation().
Referenced by SetOrientation().
|
inlinestatic |
Definition at line 196 of file albaTransform.h.
|
static |
Return the scale factors of the current transformation matrix as an array of three float numbers.
These scale factors are not necessarily about the x, y, and z axes unless unless the scale transformation was applied before any rotations. Copied from vtkTransform::GetScale()
|
inline |
Definition at line 207 of file albaTransform.h.
References GetScale().
Referenced by GetScale().
|
inline |
Definition at line 208 of file albaTransform.h.
|
static |
Apply a scale transform.
By default the scale matrix is premultiplied
|
inline |
Definition at line 216 of file albaTransform.h.
|
static |
Set/Get internal matrix versor.
|
inlinestatic |
Definition at line 222 of file albaTransform.h.
References albaMatrix::GetVersor().
|
inlinestatic |
Definition at line 223 of file albaTransform.h.
|
inline |
Definition at line 230 of file albaTransform.h.
References albaTransformBase::GetMatrix(), and GetVersor().
Referenced by GetVersor().
|
inline |
Definition at line 231 of file albaTransform.h.
References albaTransformBase::GetMatrix(), and GetVersor().
Referenced by GetVersor().
|
static |
Copy the 3x3 rotation matrix from another 4x4 matrix into the specified matrix, or in the internal matrix.
|
inline |
Definition at line 236 of file albaTransform.h.
References CopyRotation().
Referenced by CopyRotation().
|
static |
Copy the translation vector.
|
inline |
Definition at line 240 of file albaTransform.h.
References CopyTranslation().
Referenced by CopyTranslation().
|
static |
Add two vectors.
|
static |
Build vector with origin in p1 pointing to p2.
|
static |
Build vector [coeff * inVector].
|
static |
Project in_vector on in_axis direction; in_axis does not need to be normalised.
The projection signed value is returned
|
static |
Project in_vector on the plane identified by the normal vector in_plane_normal; in_plane_normal does not need to be normalised.
The norm of the projection is returned and the projection vector is written in out_projection vector if provided.
|
static |
Find perpendicular versors to input versor N.
|
static |
Multiply vector by scalar.
int albaTransform::MatrixToAttitudeVector | ( | const albaMatrix & | matrix, |
double | attitude_vector[3] | ||
) |
rotation representation conversion
int albaTransform::MatrixToEulerCardanicAngle | ( | const albaMatrix & | matrix, |
int | i, | ||
int | j, | ||
int | k, | ||
double | euler_cardan[3], | ||
double | tentative_euler_cardan_first, | ||
double | tentative_euler_cardan_second, | ||
double | tentative_euler_cardan_third | ||
) |
rotation representation conversion
int albaTransform::MatrixTommuQuaternion | ( | const albaMatrix & | matrix, |
double | quaternion[4] | ||
) |
rotation representation conversion
int albaTransform::QuaternionToMatrix | ( | double | quaternion[4], |
albaMatrix & | matrix | ||
) |
rotation representation conversion
int albaTransform::HelicalAxisToMatrix | ( | double | helical_axis[3], |
double | angle, | ||
albaMatrix & | matrix | ||
) |
rotation + translation representation conversion
int albaTransform::AttitudeVectorToMatrix | ( | double | attitude_vector[3], |
albaMatrix & | matrix | ||
) |
rotation representation conversion
int albaTransform::EulerCardanicAngleToMatrix | ( | double | euler_cardan[3], |
int | i, | ||
int | j, | ||
int | k, | ||
albaMatrix & | matrix | ||
) |
rotation representation conversion
int albaTransform::MatrixToHelicalAxis | ( | const albaMatrix & | matrix, |
double | helical_axis[3], | ||
double | point[3], | ||
double & | phi, | ||
double & | t, | ||
int | intersect | ||
) |
rotation + translation representation conversion
|
static |
|
static |
|
inlineprotectedvirtual |
This only sets the timestamp for the output matrix: output matrix is not computed inside InternalUpdate since this is not a procedural transform.
Implements albaTransformBase.
Definition at line 330 of file albaTransform.h.