core/vcsl/vcsl_translation.h
Go to the documentation of this file.
00001 // This is core/vcsl/vcsl_translation.h
00002 #ifndef vcsl_translation_h_
00003 #define vcsl_translation_h_
00004 //:
00005 // \file
00006 // \brief Translation transformation
00007 // \author François BERTEL
00008 //
00009 // \verbatim
00010 //  Modifications
00011 //   2000/06/28 François BERTEL Creation. Adapted from IUE
00012 //   2001/04/10 Ian Scott (Manchester) Converted perceps header to doxygen
00013 //   2002/01/22 Peter Vanroose - return type of execute() and inverse() changed to non-ptr
00014 //   2002/01/28 Peter Vanroose - vcl_vector member vector_ changed to non-ptr
00015 //   2004/09/17 Peter Vanroose - made vector() 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_translation_sptr.h>
00020 #include <vnl/vnl_vector.h>
00021 
00022 //: Translation transformation
00023 class vcsl_translation
00024   :public vcsl_spatial_transformation
00025 {
00026  public:
00027   //***************************************************************************
00028   // Constructors/Destructor
00029   //***************************************************************************
00030 
00031   // Default constructor
00032   vcsl_translation() {}
00033 
00034   // Destructor
00035   virtual ~vcsl_translation() {}
00036 
00037   //***************************************************************************
00038   // Status report
00039   //***************************************************************************
00040 
00041   //: Is `this' invertible at time `time'?
00042   //  REQUIRE: valid_time(time)
00043   // Pure virtual function of vcsl_spatial_transformation
00044   virtual bool is_invertible(double time) const;
00045 
00046   //: Is `this' correctly set ?
00047   // Virtual function of vcsl_spatial_transformation
00048   virtual bool is_valid() const
00049   { return vcsl_spatial_transformation::is_valid() &&
00050            ((this->duration()==0&&vector_.size()==1) ||
00051             this->duration()==vector_.size()); }
00052 
00053   //***************************************************************************
00054   // Transformation parameters
00055   //***************************************************************************
00056 
00057   //: Set the parameters of a static translation
00058   void set_static(vnl_vector<double> const& new_vector);
00059 
00060   //: Set the direction vector variation along the time
00061   void set_vector(list_of_vectors const&new_vector){vector_=new_vector;}
00062 
00063   //: Return the angle variation along the time
00064   list_of_vectors vector() const { return vector_; }
00065 
00066   //***************************************************************************
00067   // Basic operations
00068   //***************************************************************************
00069 
00070   //: Image of `v' by `this'
00071   //  REQUIRE: is_valid()
00072   // Pure virtual function of vcsl_spatial_transformation
00073   virtual vnl_vector<double> execute(const vnl_vector<double> &v,
00074                                      double time) const;
00075 
00076   //: Image of `v' by the inverse of `this'
00077   //  REQUIRE: is_valid()
00078   //  REQUIRE: is_invertible(time)
00079   // Pure virtual function of vcsl_spatial_transformation
00080   virtual vnl_vector<double> inverse(const vnl_vector<double> &v,
00081                                      double time) const;
00082 
00083  protected:
00084   //: Compute the value of the parameter at time `time'
00085   vnl_vector<double> vector_value(double time) const;
00086 
00087   //: Direction vector variation along the time
00088   list_of_vectors vector_;
00089 };
00090 
00091 #endif // vcsl_translation_h_