home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / MEDIT.LZH / BEZIER.H < prev    next >
C/C++ Source or Header  |  1995-09-26  |  947b  |  45 lines

  1. #ifndef _BEZIER_
  2. #define _BEZIER_
  3. #ifndef TRUE
  4. #define TRUE 1
  5. #define FALSE 0
  6. #endif
  7.  
  8. enum BezierControl {BCInd, BCdep, BCsame};
  9.  
  10. class Vector;
  11. class Bezier {
  12. public:
  13.     int allocpoints;
  14.     int points;
  15.     int lengthvalid;
  16.     Vector *point;  // alloc = 3points+1
  17.     double *length; // alloc = points
  18.  
  19.     double GetRate(double l);
  20.     Vector GetPoint(double t);
  21.     Vector GetVector(double t);
  22.     double TotalLength(void);
  23.     void UpdateLength(void);
  24.     void UpdateLength(int i);
  25.  
  26.     void AddPoint(Vector& v1, Vector& v2, Vector& v3);
  27.     void AddPoint(Vector& p1, Vector& p2);
  28.     void AddSpline(Vector *p, int num);
  29.  
  30.     void MovePoint(int pos, Vector& p, BezierControl flag = BCdep);
  31.     void InsertPoint(int pos);
  32.     void InsertPoint(int pos, Vector& v1, Vector& v2);
  33.     void DeletePoint(int pos);
  34.  
  35.     Bezier();
  36.     Bezier(Bezier& b);
  37.     Bezier(Vector& v1);
  38.     Bezier(Vector& v1, Vector& v2);
  39.     ~Bezier();
  40.  
  41. private:
  42.     void AllocPoint(int num);
  43. };
  44.  
  45. #endif