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