ALBA
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Alba_Release
Source
Interaction
albaCameraTransform.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: ALBA (Agile Library for Biomedical Applications)
4
Module: albaCameraTransform
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 __albaCameraTransform_h
18
#define __albaCameraTransform_h
19
20
#include "
albaTransformBase.h
"
21
22
//----------------------------------------------------------------------------
23
// forward declarations :
24
//----------------------------------------------------------------------------
25
class
vtkRenderer;
26
class
vtkTransform;
27
class
vtkCamera;
28
class
albaOBB
;
29
class
vtkCallbackCommand;
30
class
vtkObject;
31
64
class
ALBA_EXPORT
albaCameraTransform
:
public
albaTransformBase
65
{
66
public
:
67
albaCameraTransform
();
68
virtual
~albaCameraTransform
();
69
70
albaTypeMacro
(
albaCameraTransform
,
albaTransformBase
);
71
72
enum
AutoPositionModalities
73
{
74
ATTACH_TO_FOCAL_POINT
,
75
ATTACH_TO_CAMERA
,
76
ATTACH_TO_CLIPPING_PLANE
77
};
78
79
enum
AutoFittingModalities
80
{
81
MAX_SCALE
,
82
MIN_SCALE
,
83
FIT_X
,
84
FIT_Y
,
85
ANISOTROPIC
,
86
NUM_OF_MAPPINGS
87
};
88
89
enum
AutoScalingModalities
90
{
91
AUTO_FITTING
,
92
PRESERVE_SIZE
93
};
94
96
void
SetRenderer
(vtkRenderer *ren);
97
99
vtkRenderer *
GetRenderer
() {
return
m_Renderer;}
100
104
void
SetBounds
(
albaOBB
*bounds) {m_Bounds=bounds;}
105
albaOBB
*
GetBounds
() {
return
m_Bounds;}
106
108
void
SetFollowPosition
(
int
flag) {m_FollowPosition=flag;
Modified
();}
109
int
GetFollowPosition
() {
return
m_FollowPosition;}
110
void
FollowPositionOn
() {SetFollowPosition(
true
);}
111
void
FollowPositionOff
() {SetFollowPosition(
false
);}
112
114
void
SetFollowOrientation
(
int
flag) {m_FollowOrientation=flag;
Modified
();}
115
int
GetFollowOrientation
() {
return
m_FollowOrientation;}
116
void
FollowOrientationOn
() {SetFollowOrientation(
true
);}
117
void
FollowOrientationOff
() {SetFollowOrientation(
false
);}
118
120
void
SetFollowScale
(
int
flag) {m_FollowScale=flag;
Modified
();}
121
int
GetFollowScale
() {
return
m_FollowScale;}
122
void
FollowScaleOn
() {SetFollowScale(
true
);}
123
void
FollowScaleOff
() {SetFollowScale(
false
);}
124
126
void
SetPositionMode
(
int
type) {m_PositionMode=type;
Modified
();}
127
int
GetPositionMode
() {
return
m_PositionMode;}
128
void
SetPositionModeToAttachToFocalPoint
() {SetPositionMode(ATTACH_TO_FOCAL_POINT);}
129
void
SetPositionModeToAttachToCamera
() {SetPositionMode(ATTACH_TO_CAMERA);}
130
void
SetPositionModeToAttachToClippingPlane
() {SetPositionMode(ATTACH_TO_CLIPPING_PLANE);}
131
133
void
SetScalingMode
(
int
mode) {m_ScalingMode=mode;}
134
int
GetScalingMode
() {
return
m_ScalingMode;}
135
141
void
SetScalingModeToAutoFitting
();
142
149
void
SetScalingModeToPreserveSize
();
150
152
void
SetFittingMode
(
int
mode) {m_FittingMode=mode;
Modified
();}
153
int
GetFittingMode
() {
return
m_FittingMode;}
154
158
virtual
unsigned
long
GetMTime
();
159
160
virtual
int
DeepCopy
(
albaCameraTransform
*trans);
161
163
void
UpdatePoseMatrix
(
albaMatrix
*matrix,
albaMatrix
*old_view_matrix,
albaMatrix
*new_view_matrix);
164
169
static
void
AutoOrientation
(
albaMatrix
*matrix,vtkRenderer *ren);
170
void
AutoOrientation
() {
AutoOrientation
(m_Matrix,m_Renderer);}
171
175
static
void
AutoPosition
(
albaMatrix
*matrix,vtkRenderer *ren,
int
mode=ATTACH_TO_FOCAL_POINT);
176
void
AutoPosition
() {
AutoPosition
(m_Matrix,m_Renderer,m_PositionMode);}
177
182
static
void
AutoFitting
(
albaMatrix
*matrix,
albaOBB
*tracked_bounds,vtkRenderer *ren,
int
mode=MIN_SCALE);
183
void
AutoFitting
() {
AutoFitting
(m_Matrix,m_Bounds,m_Renderer,m_FittingMode);}
184
190
static
void
AutoFitting2
(
albaMatrix
*matrix,
albaOBB
*tracked_bounds,vtkRenderer *ren,
int
mode=ANISOTROPIC);
191
void
AutoFitting2
() {
AutoFitting2
(m_Matrix,m_Bounds,m_Renderer,m_FittingMode);}
192
199
static
void
ComputeScaling
(
albaOBB
*inBox,
albaOBB
*outBox,
double
*scale,
int
mode=MIN_SCALE);
200
201
void
RecomputeAll
();
202
203
protected
:
204
206
virtual
void
InternalUpdate
();
207
208
static
void
InternalProcessEvents
(vtkObject* sender,
unsigned
long
channel,
void
* clientdata,
void
* calldata);
209
210
vtkRenderer*
m_Renderer
;
211
vtkCamera*
m_Camera
;
212
int
m_FollowPosition
;
213
int
m_FollowOrientation
;
214
int
m_FollowScale
;
215
int
m_PositionMode
;
216
int
m_ScalingMode
;
217
int
m_FittingMode
;
218
219
albaOBB
*
m_Bounds
;
220
221
float
m_OldViewAngle
;
222
double
m_OldDistance
;
223
albaMatrix
*
m_OldViewMatrix
;
224
225
vtkCallbackCommand*
m_EventRouter
;
226
227
private
:
228
albaCameraTransform
(
const
albaCameraTransform
&);
// Not implemented
229
void
operator=(
const
albaCameraTransform
&);
// Not implemented
230
};
231
232
#endif
/* __albaCameraTransform_h */
233
albaTransformBase.h
albaCameraTransform
Implement transform between view coordinates to world coordinates.
Definition:
albaCameraTransform.h:65
albaCameraTransform::FollowOrientationOn
void FollowOrientationOn()
Definition:
albaCameraTransform.h:116
albaCameraTransform::GetFittingMode
int GetFittingMode()
Definition:
albaCameraTransform.h:153
albaCameraTransform::InternalUpdate
virtual void InternalUpdate()
Updates the internal matrix.
albaCameraTransform::albaCameraTransform
albaCameraTransform()
albaCameraTransform::AutoOrientation
void AutoOrientation()
Definition:
albaCameraTransform.h:170
albaCameraTransform::m_FollowPosition
int m_FollowPosition
Flag for enabling the translation according to camera position.
Definition:
albaCameraTransform.h:212
albaCameraTransform::ComputeScaling
static void ComputeScaling(albaOBB *inBox, albaOBB *outBox, double *scale, int mode=MIN_SCALE)
Compute scale between two boxes according to given modality:
albaCameraTransform::GetMTime
virtual unsigned long GetMTime()
Get the MTime: this is the bit of magic that makes everything work.
albaCameraTransform::SetScalingMode
void SetScalingMode(int mode)
Set which kind of scaling should be applied to the transform.
Definition:
albaCameraTransform.h:133
albaCameraTransform::GetFollowOrientation
int GetFollowOrientation()
Definition:
albaCameraTransform.h:115
albaCameraTransform::m_OldViewMatrix
albaMatrix * m_OldViewMatrix
Definition:
albaCameraTransform.h:223
albaCameraTransform::m_OldDistance
double m_OldDistance
Definition:
albaCameraTransform.h:222
albaCameraTransform::SetPositionModeToAttachToCamera
void SetPositionModeToAttachToCamera()
Definition:
albaCameraTransform.h:129
albaCameraTransform::m_FollowScale
int m_FollowScale
Flag for enabling the scaling according to camera frustum.
Definition:
albaCameraTransform.h:214
albaCameraTransform::m_ScalingMode
int m_ScalingMode
Kind of scaling policy (.
Definition:
albaCameraTransform.h:216
albaCameraTransform::SetPositionMode
void SetPositionMode(int type)
Set the modality to fit the Z coordinate.
Definition:
albaCameraTransform.h:126
albaCameraTransform::GetRenderer
vtkRenderer * GetRenderer()
Return the renderer used as input for this transform.
Definition:
albaCameraTransform.h:99
albaCameraTransform::AutoFittingModalities
AutoFittingModalities
Definition:
albaCameraTransform.h:80
albaCameraTransform::ANISOTROPIC
@ ANISOTROPIC
set XYZ scales to fit exactly
Definition:
albaCameraTransform.h:85
albaCameraTransform::MAX_SCALE
@ MAX_SCALE
Select the maximum scale among X/Y (i.e. fit the minimum size)
Definition:
albaCameraTransform.h:81
albaCameraTransform::FIT_X
@ FIT_X
Always fit the X axis.
Definition:
albaCameraTransform.h:83
albaCameraTransform::FIT_Y
@ FIT_Y
Always fit the Y axis.
Definition:
albaCameraTransform.h:84
albaCameraTransform::MIN_SCALE
@ MIN_SCALE
Select the minimum scale X/Y (i.e. fit the maximum size)
Definition:
albaCameraTransform.h:82
albaCameraTransform::m_FollowOrientation
int m_FollowOrientation
Flag for enabling the re-orientation according to camera position.
Definition:
albaCameraTransform.h:213
albaCameraTransform::FollowOrientationOff
void FollowOrientationOff()
Definition:
albaCameraTransform.h:117
albaCameraTransform::GetFollowScale
int GetFollowScale()
Definition:
albaCameraTransform.h:121
albaCameraTransform::SetPositionModeToAttachToClippingPlane
void SetPositionModeToAttachToClippingPlane()
Definition:
albaCameraTransform.h:130
albaCameraTransform::m_Camera
vtkCamera * m_Camera
this is to find if the render's active camera is changed
Definition:
albaCameraTransform.h:211
albaCameraTransform::FollowPositionOff
void FollowPositionOff()
Definition:
albaCameraTransform.h:111
albaCameraTransform::GetFollowPosition
int GetFollowPosition()
Definition:
albaCameraTransform.h:109
albaCameraTransform::AutoFitting
static void AutoFitting(albaMatrix *matrix, albaOBB *tracked_bounds, vtkRenderer *ren, int mode=MIN_SCALE)
Change matrix scale to create a transform making two boxes to fit.Translation and Orientation are lef...
albaCameraTransform::FollowScaleOff
void FollowScaleOff()
Definition:
albaCameraTransform.h:123
albaCameraTransform::~albaCameraTransform
virtual ~albaCameraTransform()
albaCameraTransform::AutoPosition
void AutoPosition()
Definition:
albaCameraTransform.h:176
albaCameraTransform::m_Renderer
vtkRenderer * m_Renderer
This stores the renderer used as input.
Definition:
albaCameraTransform.h:210
albaCameraTransform::SetRenderer
void SetRenderer(vtkRenderer *ren)
Set the renderer used as input for this transform.
albaCameraTransform::DeepCopy
virtual int DeepCopy(albaCameraTransform *trans)
albaCameraTransform::m_OldViewAngle
float m_OldViewAngle
Definition:
albaCameraTransform.h:221
albaCameraTransform::FollowScaleOn
void FollowScaleOn()
Definition:
albaCameraTransform.h:122
albaCameraTransform::AutoPosition
static void AutoPosition(albaMatrix *matrix, vtkRenderer *ren, int mode=ATTACH_TO_FOCAL_POINT)
change matrix translation to create a transform making points to be centered into the camera's focal ...
albaCameraTransform::SetFollowOrientation
void SetFollowOrientation(int flag)
Enable/Disable following of the camera orientation.
Definition:
albaCameraTransform.h:114
albaCameraTransform::SetBounds
void SetBounds(albaOBB *bounds)
Set the bounds of the object that should follow the camera.
Definition:
albaCameraTransform.h:104
albaCameraTransform::SetPositionModeToAttachToFocalPoint
void SetPositionModeToAttachToFocalPoint()
Definition:
albaCameraTransform.h:128
albaCameraTransform::SetScalingModeToAutoFitting
void SetScalingModeToAutoFitting()
Set scaling mode to AUTO_FITTING: the transform try to fit the given m_Bounds (see SetBounds() ) to t...
albaCameraTransform::AutoPositionModalities
AutoPositionModalities
Definition:
albaCameraTransform.h:73
albaCameraTransform::ATTACH_TO_FOCAL_POINT
@ ATTACH_TO_FOCAL_POINT
Follow the focal point.
Definition:
albaCameraTransform.h:74
albaCameraTransform::ATTACH_TO_CAMERA
@ ATTACH_TO_CAMERA
Follow the camera position.
Definition:
albaCameraTransform.h:75
albaCameraTransform::SetFollowPosition
void SetFollowPosition(int flag)
Enable/Disable following of the camera position.
Definition:
albaCameraTransform.h:108
albaCameraTransform::SetFittingMode
void SetFittingMode(int mode)
set which kind of AutoFitting strategy should be used
Definition:
albaCameraTransform.h:152
albaCameraTransform::RecomputeAll
void RecomputeAll()
albaCameraTransform::m_EventRouter
vtkCallbackCommand * m_EventRouter
Definition:
albaCameraTransform.h:225
albaCameraTransform::SetScalingModeToPreserveSize
void SetScalingModeToPreserveSize()
(not yet implemented) Set scaling mode to PRESERVE_SIZE.
albaCameraTransform::GetBounds
albaOBB * GetBounds()
Definition:
albaCameraTransform.h:105
albaCameraTransform::m_FittingMode
int m_FittingMode
Kind of scaling used to fit the view frustum.
Definition:
albaCameraTransform.h:217
albaCameraTransform::m_PositionMode
int m_PositionMode
Modality defining the rule to set the position with respect to the camera.
Definition:
albaCameraTransform.h:215
albaCameraTransform::InternalProcessEvents
static void InternalProcessEvents(vtkObject *sender, unsigned long channel, void *clientdata, void *calldata)
albaCameraTransform::UpdatePoseMatrix
void UpdatePoseMatrix(albaMatrix *matrix, albaMatrix *old_view_matrix, albaMatrix *new_view_matrix)
Change the given matrix to follow camera movements.
albaCameraTransform::AutoOrientation
static void AutoOrientation(albaMatrix *matrix, vtkRenderer *ren)
change matrix orientation to create a transform making points to be oriented according to camera orie...
albaCameraTransform::m_Bounds
albaOBB * m_Bounds
m_Bounds of the object that should follow the camera
Definition:
albaCameraTransform.h:219
albaCameraTransform::AutoScalingModalities
AutoScalingModalities
Definition:
albaCameraTransform.h:90
albaCameraTransform::AUTO_FITTING
@ AUTO_FITTING
scale the bounds to fit the camera frustum
Definition:
albaCameraTransform.h:91
albaCameraTransform::AutoFitting2
static void AutoFitting2(albaMatrix *matrix, albaOBB *tracked_bounds, vtkRenderer *ren, int mode=ANISOTROPIC)
Change matrix scale to create a transform making two boxes to fit.
albaCameraTransform::AutoFitting
void AutoFitting()
Definition:
albaCameraTransform.h:183
albaCameraTransform::GetScalingMode
int GetScalingMode()
Definition:
albaCameraTransform.h:134
albaCameraTransform::AutoFitting2
void AutoFitting2()
Definition:
albaCameraTransform.h:191
albaCameraTransform::SetFollowScale
void SetFollowScale(int flag)
Enable/Disable following of the camera scaling.
Definition:
albaCameraTransform.h:120
albaCameraTransform::GetPositionMode
int GetPositionMode()
Definition:
albaCameraTransform.h:127
albaCameraTransform::albaTypeMacro
albaTypeMacro(albaCameraTransform, albaTransformBase)
albaCameraTransform::FollowPositionOn
void FollowPositionOn()
Definition:
albaCameraTransform.h:110
albaMatrix
albaMatrix - Time stamped 4x4 Matrix.
Definition:
albaMatrix.h:44
albaOBB
This class simply stores a Box boundary (i.e.
Definition:
albaOBB.h:37
albaTransformBase
Superclass for Homogeneous transformations.
Definition:
albaTransformBase.h:47
albaTransformBase::Modified
void Modified()
update modification time stamp for this object
Definition:
albaTransformBase.h:168
Generated by
1.9.5