core/vcsl/vcsl_matrix.h
Go to the documentation of this file.
00001 // This is core/vcsl/vcsl_matrix.h
00002 #ifndef vcsl_matrix_h_
00003 #define vcsl_matrix_h_
00004 //:
00005 // \file
00006 // \brief A coordinate transformation specified by a transformation matrix
00007 // \author François BERTEL
00008 //
00009 // \verbatim
00010 //  Modifications
00011 //   2000/07/19 François BERTEL Creation.
00012 //   2002/01/22 Peter Vanroose - return type of execute() and inverse() changed to non-ptr
00013 //   2002/01/28 Peter Vanroose - vcl_vector member matrix_ changed to non-ptr
00014 //   2002/12/30 Peter Vanroose - removed unused and commented out member _vector
00015 //   2004/09/17 Peter Vanroose - made matrix_list() non-virtual - it just returns a member and should not be overloaded
00016 // \endverbatim
00017 
00018 #include <vcsl/vcsl_spatial_transformation.h>
00019 #include <vcsl/vcsl_matrix_sptr.h>
00020 #include <vcsl/vcsl_matrix_param.h>
00021 #include <vnl/vnl_vector.h>
00022 #include <vnl/vnl_matrix.h>
00023 
00024 //: A coordinate transformation specified by a transformation matrix
00025 class vcsl_matrix
00026   :public vcsl_spatial_transformation
00027 {
00028  public:
00029   //***************************************************************************
00030   // Constructors/Destructor
00031   //***************************************************************************
00032 
00033   // Default constructor
00034   vcsl_matrix() {}
00035 
00036   // Destructor
00037   virtual ~vcsl_matrix() {}
00038 
00039   //***************************************************************************
00040   // Status report
00041   //***************************************************************************
00042 
00043   //: Is `this' invertible at time `time'?
00044   //  REQUIRE: valid_time(time)
00045   // Pure virtual function of vcsl_spatial_transformation
00046   virtual bool is_invertible(double time) const;
00047 
00048   //: Is `this' correctly set ?
00049   // Virtual function of vcsl_spatial_transformation
00050   virtual bool is_valid() const
00051   { return vcsl_spatial_transformation::is_valid() && this->duration()==matrix_.size(); }
00052 
00053   //***************************************************************************
00054   // Transformation parameters
00055   //***************************************************************************
00056 
00057   //: Set the parameters of a static translation
00058   void set_static( vcsl_matrix_param_sptr new_matrix);
00059 
00060   //: Set the direction vector variation along the time
00061   void set_matrix(list_of_vcsl_matrix_param_sptr const& m) { matrix_=m; }
00062 
00063   list_of_vcsl_matrix_param_sptr matrix_list() const { return matrix_; }
00064 
00065   // Pure virtual function of vcsl_spatial_transformation
00066   virtual vnl_vector<double> execute(const vnl_vector<double> &v,
00067                                      double time) const;
00068 
00069   // Pure virtual function of vcsl_spatial_transformation
00070   virtual vnl_vector<double> inverse(const vnl_vector<double> &v,
00071                                      double time) const;
00072 
00073  protected:
00074   vnl_matrix<double> param_to_matrix(vcsl_matrix_param_sptr from,bool type) const;
00075   vnl_matrix<double> matrix_value(double time, bool type) const;
00076   list_of_vcsl_matrix_param_sptr matrix_;
00077 };
00078 
00079 #endif // vcsl_matrix_h_