00001 // This is gel/vdgl/vdgl_interpolator.h 00002 #ifndef vdgl_interpolator_h_ 00003 #define vdgl_interpolator_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \brief Represents a 2D interpolator for a vdgl_edgel_chain 00010 // \author Geoff Cross 00011 // 00012 // introduced new method get_tangent_angle, which is based on the actual 00013 // curve geometry. The old method get_theta strictly refers to the 00014 // stored gradient directions and shouldn't be used for geometric operations. 00015 // In this regard, curvature is not a valid computation of geometric curvature 00016 // and should be changed. Currently it is the rate of change of gradient direction 00017 // 00018 // \verbatim 00019 // Modifications 00020 // 01-dec-2003 J.L. Mundy 00021 // 10-sep-2004 Peter Vanroose Added copy ctor with explicit vbl_ref_count init 00022 // \endverbatim 00023 00024 #include <vdgl/vdgl_interpolator_sptr.h> 00025 #include <vul/vul_timestamp.h> 00026 #include <vbl/vbl_ref_count.h> 00027 #include <vdgl/vdgl_edgel_chain_sptr.h> 00028 #include <vsol/vsol_point_2d_sptr.h> 00029 00030 class vdgl_interpolator : public vul_timestamp, 00031 public vbl_ref_count 00032 { 00033 // PUBLIC INTERFACE---------------------------------------------------------- 00034 public: 00035 00036 // Constructors/Destructors-------------------------------------------------- 00037 00038 vdgl_interpolator(vdgl_edgel_chain_sptr chain) : chain_(chain) {} 00039 00040 vdgl_interpolator(vdgl_interpolator const& x) 00041 : vul_timestamp(), vbl_ref_count(), chain_(x.chain_) {} 00042 00043 // Operators---------------------------------------------------------------- 00044 00045 //: order of interpolation 1=linear, 2 = quadratic, 3 = cubic, ..etc. 00046 virtual short order() const = 0; 00047 //: interpolation 0th degree 00048 virtual double get_x(double index)= 0; 00049 virtual double get_y(double index)= 0; 00050 00051 //: interpolation 1st degree 00052 virtual double get_grad(double index) = 0; 00053 virtual double get_theta(double index)= 0; 00054 virtual double get_tangent_angle(double index)= 0; 00055 00056 //: interpolation 2nd degree 00057 virtual double get_curvature(double index)= 0; 00058 00059 //: integral 00060 virtual double get_length()= 0; 00061 00062 //: bounding box 00063 virtual double get_min_x()= 0; 00064 virtual double get_max_x()= 0; 00065 virtual double get_min_y()= 0; 00066 virtual double get_max_y()= 0; 00067 00068 //: find closest point on the curve to the input point 00069 virtual vsol_point_2d_sptr closest_point_on_curve ( vsol_point_2d_sptr p ) = 0; 00070 virtual double distance_curve_to_point ( vsol_point_2d_sptr p ); 00071 00072 // Data Access--------------------------------------------------------------- 00073 00074 vdgl_edgel_chain_sptr get_edgel_chain() const { return chain_; } 00075 00076 // INTERNALS----------------------------------------------------------------- 00077 protected: 00078 // Data Members-------------------------------------------------------------- 00079 00080 vdgl_edgel_chain_sptr chain_; 00081 }; 00082 00083 #endif // vdgl_interpolator_h_