core
vcsl
vcsl_spatial_transformation.h
Go to the documentation of this file.
1
// This is core/vcsl/vcsl_spatial_transformation.h
2
#ifndef vcsl_spatial_transformation_h_
3
#define vcsl_spatial_transformation_h_
4
//:
5
// \file
6
// \author Francois BERTEL
7
// \brief Transformation between 2 spatial coordinate systems
8
//
9
// \verbatim
10
// Modifications
11
// 2000/06/28 Francois BERTEL Creation. Adapted from IUE
12
// 2001/04/10 Ian Scott (Manchester) Converted perceps header to doxygen
13
// 2002/01/22 Peter Vanroose - added lmi() as it is used in vcsl_matrix.cxx
14
// 2002/01/22 Peter Vanroose - return type of lqi(), lvi(), execute() and inverse() changed to non-ptr
15
// 2002/01/28 Peter Vanroose - std::vector members beat_ and interpolator_ changed to non-ptr
16
// 2004/09/10 Peter Vanroose - Added explicit copy constructor (ref_count !)
17
// 2004/09/17 Peter Vanroose - made beat() and interpolators() non-virtual: they just return a member and should not be overloaded
18
// \endverbatim
19
20
#include <vector>
21
#include <
vcsl/vcsl_spatial_transformation_sptr.h
>
22
23
#include <
vbl/vbl_ref_count.h
>
24
#ifdef _MSC_VER
25
# include <vcl_msvc_warnings.h>
26
#endif
27
#include <
vnl/vnl_vector.h
>
28
#include <
vnl/vnl_quaternion.h
>
29
30
typedef
std::vector<double>
list_of_scalars
;
31
typedef
std::vector<vnl_vector<double> >
list_of_vectors
;
32
33
enum
vcsl_interpolator
34
{
35
vcsl_linear
,
36
vcsl_cubic
,
37
vcsl_spline
38
};
39
40
//: Transformation between 2 spatial coordinate systems
41
// A spatial transformation can be static or dynamic
42
class
vcsl_spatial_transformation
:
public
vbl_ref_count
43
{
44
//***************************************************************************
45
// Constructors/Destructor
46
//***************************************************************************
47
48
protected
:
49
// Default constructor. Do nothing
50
vcsl_spatial_transformation
() =
default
;
51
52
public
:
53
// Copy constructor
54
vcsl_spatial_transformation
(
vcsl_spatial_transformation
const
& x)
55
:
vbl_ref_count
(),
beat_
(x.
beat_
),
interpolator_
(x.
interpolator_
) {}
56
57
// Destructor. Do nothing
58
~vcsl_spatial_transformation
()
override
=
default
;
59
60
//***************************************************************************
61
// Status report
62
//***************************************************************************
63
64
//: Return the list of time clocks
65
std::vector<double>
beat
()
const
{
return
beat_
; }
66
67
//: Return the time duration
68
unsigned
int
duration
()
const
{
return
(
unsigned
int
)(
beat_
.size()); }
69
70
//: Return the list of interpolators
71
std::vector<vcsl_interpolator>
interpolators
()
const
{
return
interpolator_
; }
72
73
//: Is `time' between the two time bounds ?
74
bool
valid_time
(
double
time)
const
;
75
76
//: Is `this' invertible at time `time'?
77
// REQUIRE: valid_time(time)
78
virtual
bool
is_invertible
(
double
time)
const
=0;
79
80
//: Is `this' correctly set ?
81
virtual
bool
is_valid
()
const
82
{
return
(
duration
()==0&&
interpolator_
.size()==0) ||
83
(
duration
()==
interpolator_
.size()+1); }
84
85
//***************************************************************************
86
// Basic operations
87
//***************************************************************************
88
89
//: Return the index of the beat inferior or equal to `time'
90
// REQUIRE: valid_time(time)
91
int
matching_interval
(
double
time)
const
;
92
93
//: Image of `v' by `this'
94
// REQUIRE: is_valid()
95
virtual
vnl_vector<double>
execute
(
const
vnl_vector<double>
&v,
96
double
time)
const
=0;
97
98
//: Image of `v' by the inverse of `this'
99
// REQUIRE: is_invertible(time)
100
// REQUIRE: is_valid()
101
virtual
vnl_vector<double>
inverse
(
const
vnl_vector<double>
&v,
102
double
time)
const
=0;
103
104
//***************************************************************************
105
// Status setting
106
//***************************************************************************
107
108
//: Set the list of time clocks
109
void
set_beat
(std::vector<double>
const
& new_beat) {
beat_
=new_beat; }
110
111
//: Set the list of interpolators
112
void
set_interpolators
(std::vector<vcsl_interpolator>
const
& i) {
interpolator_
=i; }
113
114
//: Empty the time clock and interpolators, thereby making the transf static
115
void
set_static
();
116
117
//***************************************************************************
118
// Interpolators
119
//***************************************************************************
120
121
//: Linear interpolation on scalar values
122
double
lsi
(
double
v0,
123
double
v1,
124
int
index,
125
double
time)
const
;
126
127
//: Linear interpolation on vnl_vectors
128
vnl_vector<double>
lvi
(
const
vnl_vector<double>
&v0,
129
const
vnl_vector<double>
&v1,
130
int
index,
131
double
time)
const
;
132
133
//: Linear interpolation on vnl_matrices
134
vnl_matrix<double>
lmi
(
const
vnl_matrix<double>
&m0,
135
const
vnl_matrix<double>
&m1,
136
int
index,
137
double
time)
const
;
138
139
//: Linear interpolation on quaternions
140
vnl_quaternion<double>
lqi
(
const
vnl_quaternion<double>
&v0,
141
const
vnl_quaternion<double>
&v1,
142
int
index,
143
double
time)
const
;
144
145
protected
:
146
//: List of time clocks
147
std::vector<double>
beat_
;
148
std::vector<vcsl_interpolator>
interpolator_
;
149
};
150
151
#endif // vcsl_spatial_transformation_h_
vcsl_spatial_transformation::duration
unsigned int duration() const
Return the time duration.
Definition:
vcsl_spatial_transformation.h:68
vcsl_spatial_transformation::set_beat
void set_beat(std::vector< double > const &new_beat)
Set the list of time clocks.
Definition:
vcsl_spatial_transformation.h:109
vcsl_spatial_transformation::beat
std::vector< double > beat() const
Return the list of time clocks.
Definition:
vcsl_spatial_transformation.h:65
vcsl_spatial_transformation_sptr.h
vcsl_spatial_transformation
Transformation between 2 spatial coordinate systems.
Definition:
vcsl_spatial_transformation.h:42
vcsl_spline
Definition:
vcsl_spatial_transformation.h:37
vcsl_spatial_transformation::lvi
vnl_vector< double > lvi(const vnl_vector< double > &v0, const vnl_vector< double > &v1, int index, double time) const
Linear interpolation on vnl_vectors.
Definition:
vcsl_spatial_transformation.cxx:69
vcsl_spatial_transformation::lqi
vnl_quaternion< double > lqi(const vnl_quaternion< double > &v0, const vnl_quaternion< double > &v1, int index, double time) const
Linear interpolation on quaternions.
Definition:
vcsl_spatial_transformation.cxx:121
list_of_vectors
std::vector< vnl_vector< double > > list_of_vectors
Definition:
vcsl_spatial_transformation.h:31
vcsl_spatial_transformation::lsi
double lsi(double v0, double v1, int index, double time) const
Linear interpolation on scalar values.
Definition:
vcsl_spatial_transformation.cxx:53
vcsl_cubic
Definition:
vcsl_spatial_transformation.h:36
vcsl_spatial_transformation::lmi
vnl_matrix< double > lmi(const vnl_matrix< double > &m0, const vnl_matrix< double > &m1, int index, double time) const
Linear interpolation on vnl_matrices.
Definition:
vcsl_spatial_transformation.cxx:94
vcsl_spatial_transformation::beat_
std::vector< double > beat_
List of time clocks.
Definition:
vcsl_spatial_transformation.h:147
vcsl_interpolator
vcsl_interpolator
Definition:
vcsl_spatial_transformation.h:33
vcsl_spatial_transformation::vcsl_spatial_transformation
vcsl_spatial_transformation(vcsl_spatial_transformation const &x)
Definition:
vcsl_spatial_transformation.h:54
vnl_quaternion
vcsl_spatial_transformation::inverse
virtual vnl_vector< double > inverse(const vnl_vector< double > &v, double time) const =0
Image of ‘v’ by the inverse of ‘this’.
vcsl_spatial_transformation::interpolator_
std::vector< vcsl_interpolator > interpolator_
Definition:
vcsl_spatial_transformation.h:148
vcsl_spatial_transformation::execute
virtual vnl_vector< double > execute(const vnl_vector< double > &v, double time) const =0
Image of ‘v’ by ‘this’.
vcsl_spatial_transformation::set_interpolators
void set_interpolators(std::vector< vcsl_interpolator > const &i)
Set the list of interpolators.
Definition:
vcsl_spatial_transformation.h:112
vcsl_spatial_transformation::set_static
void set_static()
Empty the time clock and interpolators, thereby making the transf static.
Definition:
vcsl_spatial_transformation.cxx:44
vnl_vector.h
vnl_matrix< double >
vcsl_linear
Definition:
vcsl_spatial_transformation.h:35
vcsl_spatial_transformation::is_invertible
virtual bool is_invertible(double time) const =0
Is ‘this’ invertible at time ‘time’?.
vcsl_spatial_transformation::is_valid
virtual bool is_valid() const
Is ‘this’ correctly set ?.
Definition:
vcsl_spatial_transformation.h:81
vnl_vector< double >
vcsl_spatial_transformation::interpolators
std::vector< vcsl_interpolator > interpolators() const
Return the list of interpolators.
Definition:
vcsl_spatial_transformation.h:71
vcsl_spatial_transformation::~vcsl_spatial_transformation
~vcsl_spatial_transformation() override=default
vcsl_spatial_transformation::matching_interval
int matching_interval(double time) const
Return the index of the beat inferior or equal to ‘time’.
Definition:
vcsl_spatial_transformation.cxx:22
vcsl_spatial_transformation::valid_time
bool valid_time(double time) const
Is ‘time’ between the two time bounds ?.
Definition:
vcsl_spatial_transformation.cxx:12
vbl_ref_count.h
list_of_scalars
std::vector< double > list_of_scalars
Definition:
vcsl_spatial_transformation.h:30
vbl_ref_count
vnl_quaternion.h
vcsl_spatial_transformation::vcsl_spatial_transformation
vcsl_spatial_transformation()=default
Generated by
1.8.15