ALBA
albaTransformBase.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaTransformBase
5 Authors: Marco Petrone
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaTransformBase_h
18#define __albaTransformBase_h
19
21#include "albaMTime.h"
22#include "albaMutexLock.h"
23#include "albaMatrix.h"
24#include "albaSmartPointer.h"
26
27//------------------------------------------------------------------------------
28// Forward declarations
29//------------------------------------------------------------------------------
30class vtkLinearTransform;
32
33#ifdef ALBA_EXPORTS
34template class ALBA_EXPORT albaAutoPointer<albaMatrix>;
35#endif
36
47{
48public:
51
54
56 virtual void Print(std::ostream& os, const int indent=0) const;
57
59 virtual const albaMatrix &GetMatrix() {Update();return *m_Matrix;}
60
64 albaMatrix *GetMatrixPointer() {Update(); return m_Matrix;}
65
69 void TransformPoint(const float in[3], float out[3]) \
70 { this->Update(); this->InternalTransformPoint(in,out); };
71
75 void TransformPoint(const double in[3], double out[3]) \
76 { this->Update(); this->InternalTransformPoint(in,out); };
77
78
83 void TransformNormalAtPoint(const float point[3], const float in[3],
84 float out[3]);
89 void TransformNormalAtPoint(const double point[3], const double in[3],
90 double out[3]);
91
96 void TransformVectorAtPoint(const float point[3], const float in[3],
97 float out[3]);
102 void TransformVectorAtPoint(const double point[3], const double in[3],
103 double out[3]);
104
111 virtual void Update();
112
114 void Modified();
115
119 virtual void InternalTransformPoint(const double in[3], double out[3]);
120 virtual void InternalTransformPoint(const float in[3], float out[3]);
121
123 //virtual albaTransformBase *MakeTransform() = 0;
124
127 //virtual int CircuitCheck(albaTransformBase *transform);
128
130 virtual unsigned long GetMTime() {return m_MTime.GetMTime();}
131
133 virtual unsigned long GetUpdateTime() {return m_UpdateTime.GetMTime();}
134
136 void SetTimeStamp(albaTimeStamp t) {if (!albaEquals(m_TimeStamp,t)){m_TimeStamp=t; Modified();}}
137
138 albaTimeStamp GetTimeStamp() {return m_TimeStamp;}
139
140#ifdef ALBA_USE_VTK
142 vtkLinearTransform *GetVTKTransform();
143
145 operator vtkLinearTransform*() {return GetVTKTransform();}
146#endif
147
148protected:
153
155
156 #ifdef ALBA_USE_VTK
157 vtkALBAToLinearTransform *m_VTKTransform;
158 #endif
159
161 virtual void InternalUpdate() = 0;
162
163private:
164
165};
166
167//------------------------------------------------------------------------------
169//------------------------------------------------------------------------------
170{
172}
173
174
175#endif
176
177
178
179
180
ALBA_EXPORT bool albaEquals(double x, double y)
reliable comparison test for floating point numbers.
double albaTimeStamp
type for time varying data timestamps (not for pipelines timestamps!)
Definition: albaDefines.h:57
Hold a reference to a T instance.
This class inerith form albaEventSender and extends albaEventSender with the capacity of send events ...
albaMTime - record modification timestamp.
Definition: albaMTime.h:38
void Modified()
Update this object modification time.
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:44
Critical section locking class that can be allocated on the stack.
Definition: albaMutexLock.h:33
albaReferenceCounted - abstract base class for ALBA objects with reference counting.
Superclass for Homogeneous transformations.
virtual void InternalUpdate()=0
Perform any subclass-specific Update.
albaTimeStamp m_TimeStamp
the timestamp to assign to the output matrix (default=0)
albaMatrix * GetMatrixPointer()
return pointer to internal matrix (after updating).
void TransformVectorAtPoint(const float point[3], const float in[3], float out[3])
Apply the transformation to a vector at the specified vertex.
virtual void InternalTransformPoint(const double in[3], double out[3])
This will calculate the transformation without calling Update.
void SetTimeStamp(albaTimeStamp t)
set the timestamp for the output matrix
albaMTime m_UpdateTime
We need to record the time of the last update.
albaMTime m_MTime
modification time
virtual const albaMatrix & GetMatrix()
update and return internal transform matrix
albaTimeStamp GetTimeStamp()
albaAutoPointer< albaMatrix > m_Matrix
internally stored matrix.
virtual void Update()
Update the transform to account for any changes which have been made.
virtual void InternalTransformPoint(const float in[3], float out[3])
void TransformNormalAtPoint(const double point[3], const double in[3], double out[3])
Apply the transformation to a normal at the specified vertex.
virtual void Print(std::ostream &os, const int indent=0) const
print debug information for this object
void TransformVectorAtPoint(const double point[3], const double in[3], double out[3])
Apply the transformation to a vector at the specified vertex.
void Modified()
update modification time stamp for this object
void TransformPoint(const double in[3], double out[3])
Apply the transformation to a double-precision coordinate.
albaAbstractTypeMacro(albaTransformBase, albaReferenceCounted)
void TransformNormalAtPoint(const float point[3], const float in[3], float out[3])
Apply the transformation to a normal at the specified vertex.
albaMutexLock m_UpdateMutex
we also need to do mutex locking so updates don't collide.
albaTransformBase(const albaTransformBase &)
copy constructor
virtual unsigned long GetUpdateTime()
return last update time
virtual unsigned long GetMTime()
Make another transform of the same type.
void TransformPoint(const float in[3], float out[3])
Apply the transformation to a coordinate.
vtkALBAToLinearTransform - convert a ALBA transform or matrix into a VTK transform.