Go to the documentation of this file.00001
00002 #ifndef vcsl_spatial_transformation_h_
00003 #define vcsl_spatial_transformation_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <vcsl/vcsl_spatial_transformation_sptr.h>
00021
00022 #include <vbl/vbl_ref_count.h>
00023 #include <vcl_vector.h>
00024 #include <vnl/vnl_vector.h>
00025 #include <vnl/vnl_quaternion.h>
00026
00027 typedef vcl_vector<double> list_of_scalars;
00028 typedef vcl_vector<vnl_vector<double> > list_of_vectors;
00029
00030 enum vcsl_interpolator
00031 {
00032 vcsl_linear,
00033 vcsl_cubic,
00034 vcsl_spline
00035 };
00036
00037
00038
00039 class vcsl_spatial_transformation : public vbl_ref_count
00040 {
00041
00042
00043
00044
00045 protected:
00046
00047 vcsl_spatial_transformation() {}
00048
00049 public:
00050
00051 vcsl_spatial_transformation(vcsl_spatial_transformation const& x)
00052 : vbl_ref_count(), beat_(x.beat_), interpolator_(x.interpolator_) {}
00053
00054
00055 virtual ~vcsl_spatial_transformation() {}
00056
00057
00058
00059
00060
00061
00062 vcl_vector<double> beat() const { return beat_; }
00063
00064
00065 unsigned int duration() const { return (unsigned int)(beat_.size()); }
00066
00067
00068 vcl_vector<vcsl_interpolator> interpolators() const { return interpolator_; }
00069
00070
00071 bool valid_time(double time) const;
00072
00073
00074
00075 virtual bool is_invertible(double time) const=0;
00076
00077
00078 virtual bool is_valid() const
00079 { return (duration()==0&&interpolator_.size()==0) ||
00080 (duration()==interpolator_.size()+1); }
00081
00082
00083
00084
00085
00086
00087
00088 int matching_interval(double time) const;
00089
00090
00091
00092 virtual vnl_vector<double> execute(const vnl_vector<double> &v,
00093 double time) const=0;
00094
00095
00096
00097
00098 virtual vnl_vector<double> inverse(const vnl_vector<double> &v,
00099 double time) const=0;
00100
00101
00102
00103
00104
00105
00106 void set_beat(vcl_vector<double> const& new_beat) { beat_=new_beat; }
00107
00108
00109 void set_interpolators(vcl_vector<vcsl_interpolator> const& i) { interpolator_=i; }
00110
00111
00112 void set_static();
00113
00114
00115
00116
00117
00118
00119 double lsi(double v0,
00120 double v1,
00121 int index,
00122 double time) const;
00123
00124
00125 vnl_vector<double> lvi(const vnl_vector<double> &v0,
00126 const vnl_vector<double> &v1,
00127 int index,
00128 double time) const;
00129
00130
00131 vnl_matrix<double> lmi(const vnl_matrix<double> &m0,
00132 const vnl_matrix<double> &m1,
00133 int index,
00134 double time) const;
00135
00136
00137 vnl_quaternion<double> lqi(const vnl_quaternion<double> &v0,
00138 const vnl_quaternion<double> &v1,
00139 int index,
00140 double time) const;
00141
00142 protected:
00143
00144 vcl_vector<double> beat_;
00145 vcl_vector<vcsl_interpolator> interpolator_;
00146 };
00147
00148 #endif // vcsl_spatial_transformation_h_