Go to the documentation of this file.00001
00002 #ifndef vcsl_spatial_h_
00003 #define vcsl_spatial_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <vcsl/vcsl_coordinate_system.h>
00019 #include <vcsl/vcsl_spatial_sptr.h>
00020 #include <vcsl/vcsl_spatial_transformation_sptr.h>
00021 #include <vcsl/vcsl_graph_sptr.h>
00022 #include <vnl/vnl_vector.h>
00023 #include <vcl_vector.h>
00024 class vcsl_cartesian_2d;
00025 class vcsl_polar;
00026 class vcsl_cartesian_3d;
00027 class vcsl_cylindrical;
00028 class vcsl_spherical;
00029
00030
00031
00032 #include <vcl_compiler.h>
00033 #ifdef VCL_ICC
00034
00035 #define VCSL_SPATIAL_VECTOR_BOOL vcl_vector<int>
00036 #else
00037 #define VCSL_SPATIAL_VECTOR_BOOL vcl_vector<bool>
00038 #endif
00039
00040
00041
00042
00043
00044
00045 class vcsl_spatial
00046 :public vcsl_coordinate_system
00047 {
00048 public:
00049
00050
00051
00052
00053
00054 vcsl_spatial() {}
00055
00056
00057 virtual ~vcsl_spatial();
00058
00059
00060
00061
00062
00063 virtual const vcsl_spatial *cast_to_spatial() const { return this; }
00064 virtual const vcsl_cartesian_2d *cast_to_cartesian_2d() const {return 0; }
00065 virtual const vcsl_polar *cast_to_polar() const {return 0; }
00066 virtual const vcsl_cartesian_3d *cast_to_cartesian_3d() const {return 0; }
00067 virtual const vcsl_cylindrical *cast_to_cylindrical() const {return 0; }
00068 virtual const vcsl_spherical *cast_to_spherical() const {return 0; }
00069
00070
00071
00072
00073
00074
00075 vcl_vector<double> beat() const { return beat_; }
00076
00077
00078 unsigned int duration() const { return (unsigned int)(beat_.size()); }
00079
00080
00081 vcl_vector<vcsl_spatial_sptr> parent() const { return parent_; }
00082
00083
00084 vcl_vector<vcsl_spatial_transformation_sptr> motion() const {return motion_;}
00085
00086
00087 bool valid_time(double time) const;
00088
00089
00090
00091
00092
00093
00094 void set_beat(vcl_vector<double> const& new_beat) { beat_=new_beat; }
00095
00096
00097 void set_parent(vcl_vector<vcsl_spatial_sptr> const& new_parent);
00098
00099
00100 void set_motion(vcl_vector<vcsl_spatial_transformation_sptr> const& m) { motion_=m; }
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114 void set_unique(const vcsl_spatial_sptr &new_parent,
00115 const vcsl_spatial_transformation_sptr &new_motion);
00116
00117
00118
00119
00120
00121
00122
00123
00124 virtual int matching_interval(double time) const;
00125
00126
00127 virtual bool path_from_local_to_cs_exists(const vcsl_spatial_sptr &other,
00128 double time);
00129
00130
00131
00132 virtual bool is_absolute(double time) const;
00133
00134
00135
00136
00137 virtual vnl_vector<double> from_local_to_cs(const vnl_vector<double> &v,
00138 const vcsl_spatial_sptr &other,
00139 double time);
00140
00141 virtual void set_graph(const vcsl_graph_sptr &new_graph);
00142
00143 private:
00144
00145 void set_reached(const bool &new_reached) { reached_=new_reached; }
00146 bool reached() const { return reached_; }
00147 friend class vcsl_graph;
00148
00149
00150
00151
00152 protected:
00153
00154
00155 virtual bool
00156 recursive_path_from_local_to_cs_exists(const vcsl_spatial_sptr &other,
00157 double time);
00158
00159
00160
00161 virtual void
00162 path_from_local_to_cs(const vcsl_spatial_sptr &other,
00163 double time,
00164 vcl_vector<vcsl_spatial_transformation_sptr> &path,
00165 VCSL_SPATIAL_VECTOR_BOOL &sens);
00166
00167
00168
00169 virtual bool
00170 recursive_path_from_local_to_cs(const vcsl_spatial_sptr &other,
00171 double time,
00172 vcl_vector<vcsl_spatial_transformation_sptr> &path,
00173 VCSL_SPATIAL_VECTOR_BOOL &sens);
00174
00175
00176 vcl_vector<vcsl_spatial_sptr> parent_;
00177
00178
00179 vcl_vector<double> beat_;
00180
00181
00182 vcl_vector<vcsl_spatial_transformation_sptr> motion_;
00183
00184
00185 vcl_vector<vcsl_spatial_sptr> potential_children_;
00186
00187
00188 vcsl_graph_sptr graph_;
00189
00190
00191 bool reached_;
00192 };
00193
00194 #endif // vcsl_spatial_h_