contrib/gel/vdgl/vdgl_interpolator_linear.h
Go to the documentation of this file.
00001 // This is gel/vdgl/vdgl_interpolator_linear.h
00002 #ifndef vdgl_interpolator_linear_h
00003 #define vdgl_interpolator_linear_h
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Represents a linear 2D interpolator for a vdgl_edgel_chain
00010 // \author Geoff Cross
00011 
00012 #include <vdgl/vdgl_interpolator.h>
00013 
00014 class vdgl_interpolator_linear : public vdgl_interpolator
00015 {
00016  public:
00017   // Constructors/Destructors--------------------------------------------------
00018 
00019   vdgl_interpolator_linear( vdgl_edgel_chain_sptr chain);
00020   ~vdgl_interpolator_linear();
00021 
00022   // Operators----------------------------------------------------------------
00023 
00024   //: order of interpolation 1=linear, 2 = quadratic, 3 = cubic, ..etc.
00025   virtual short order() const {return 1;}
00026 
00027   //: interpolation 0th degree
00028   double get_x(double index);
00029   double get_y(double index);
00030 
00031   // interpolation 1st degree
00032   double get_grad(double index);
00033   //: the image gradient direction
00034   double get_theta(double index);
00035   //:  the geometric tangent angle
00036   double get_tangent_angle(double index);
00037 
00038   //: interpolation 2nd degree
00039   double get_curvature(double index);
00040 
00041   //: integral
00042   double get_length();
00043 
00044   //: bounding box
00045   double get_min_x();
00046   double get_max_x();
00047   double get_min_y();
00048   double get_max_y();
00049 
00050   // closest point
00051   vsol_point_2d_sptr closest_point_on_curve ( vsol_point_2d_sptr p );
00052 
00053   // INTERNALS-----------------------------------------------------------------
00054  protected:
00055   // Data Members--------------------------------------------------------------
00056 
00057   double lengthcache_;
00058   double minxcache_;
00059   double maxxcache_;
00060   double minycache_;
00061   double maxycache_;
00062 
00063  private:
00064   // Helpers-------------------------------------------------------------------
00065 
00066   void recompute_all();
00067   void recompute_length();
00068   void recompute_bbox();
00069 };
00070 
00071 #endif // vdgl_interpolator_linear_h