curveset.h

Go to the documentation of this file.
00001 /* === S Y N F I G ========================================================= */
00021 /* ========================================================================= */
00022 
00023 /* === S T A R T =========================================================== */
00024 
00025 #ifndef __SYNFIG_CURVESET_H
00026 #define __SYNFIG_CURVESET_H
00027 
00028 /* === H E A D E R S ======================================================= */
00029 #include "blinepoint.h"
00030 #include <vector>
00031 
00032 /* === M A C R O S ========================================================= */
00033 
00034 /* === T Y P E D E F S ===================================================== */
00035 
00036 /* === C L A S S E S & S T R U C T S ======================================= */
00037 namespace synfig
00038 {
00039 
00040 class BLinePoint;
00041 
00042 struct CurvePoint
00043 {
00044     Point   p;
00045     Point   l,r;
00046 
00047     CurvePoint () {}
00048     CurvePoint(const Point &pin, const Vector &left, const Vector &right);
00049 
00050     CurvePoint(const BLinePoint &bpoint);
00051 };
00052 
00053 class CurveSet
00054 {
00055     bool        invert; //winding order...
00056 
00057     void CleanUp(int curve = 0);
00058 public:
00059 
00060     typedef std::vector<CurvePoint> region;
00061     typedef std::vector<region>     set_type;
00062 
00063     set_type    set; //specifies a region object (assumes looping)
00064 
00065     void SetClamp(int &i, int &si);
00066 
00067     //actual stuff
00068     CurveSet()
00069     {
00070     }
00071 
00072     //anything supporting iterator type operations
00073     template < typename Iterator >
00074     CurveSet(Iterator begin, Iterator end, bool invert = false)
00075     {
00076         set.push_back(std::vector<CurvePoint>(begin,end));
00077         CleanUp(invert);
00078     }
00079 
00080     CurveSet operator &(const CurveSet &rhs) const; //intersect
00081     CurveSet operator |(const CurveSet &rhs) const; //union
00082     CurveSet operator -(const CurveSet &rhs) const; //subtract
00083 
00084 
00085     //Point containment
00086     int intersect(const Point &p) const;
00087 };
00088 
00089 }
00090 /* === E N D =============================================================== */
00091 
00092 #endif

Generated on Wed Dec 12 03:11:41 2007 for synfig by  doxygen 1.5.4