home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / h / vd2 / VDLib / ParameterCurve.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  1.6 KB  |  61 lines

  1. #ifndef f_VD2_VDLIB_PARAMETERCURVE_H
  2. #define f_VD2_VDLIB_PARAMETERCURVE_H
  3.  
  4. #include <vd2/system/vdtypes.h>
  5. #include <vd2/system/vdstl.h>
  6. #include <vd2/system/vectors.h>
  7.  
  8. struct VDParameterCurvePoint {
  9.     double        mX;
  10.     double        mY;
  11.     bool        mbLinear;
  12.     bool        mbLinkedTangents;
  13. };
  14.  
  15. class VDParameterCurve {
  16. public:
  17.     typedef VDParameterCurvePoint Point;
  18.     typedef vdfastvector<Point> PointList;
  19.  
  20.     VDParameterCurve();
  21.     ~VDParameterCurve();
  22.  
  23.     int AddRef();
  24.     int Release();
  25.  
  26.     float GetYMin() const { return mMinVal; }
  27.     float GetYMax() const { return mMaxVal; }
  28.  
  29.     void SetYRange(float minVal, float maxVal) { mMinVal = minVal; mMaxVal = maxVal; }
  30.  
  31.     PointList& Points() { return mPoints; }
  32.     const PointList& Points() const { return mPoints; }
  33.  
  34.     PointList::iterator Begin() { return mPoints.begin(); }
  35.     PointList::const_iterator Begin() const { return mPoints.begin(); }
  36.  
  37.     PointList::iterator End() { return mPoints.end(); }
  38.     PointList::const_iterator End() const { return mPoints.end(); }
  39.  
  40.     VDParameterCurvePoint operator()(double x) const;
  41.  
  42.     PointList::iterator            LowerBound(double x);
  43.     PointList::const_iterator    LowerBound(double x) const;
  44.     PointList::iterator            UpperBound(double x);
  45.     PointList::const_iterator    UpperBound(double x) const;
  46.     PointList::iterator            GetNearestPointX(double x);
  47.     PointList::const_iterator    GetNearestPointX(double x) const;
  48.     PointList::iterator            GetNearestPoint2D(double x, double y, double xRadius, double yScale);
  49.     PointList::const_iterator    GetNearestPoint2D(double x, double y, double xRadius, double yScale) const;
  50.  
  51. protected:
  52.     PointList mPoints;
  53.  
  54.     float    mMinVal;
  55.     float    mMaxVal;
  56.  
  57.     int mRefCount;
  58. };
  59.  
  60. #endif
  61.