00001 /* === S Y N F I G ========================================================= */ 00021 /* ========================================================================= */ 00022 00023 /* === S T A R T =========================================================== */ 00024 00025 #ifndef __SYNFIG_BLINEPOINT_H 00026 #define __SYNFIG_BLINEPOINT_H 00027 00028 /* === H E A D E R S ======================================================= */ 00029 00030 #include "vector.h" 00031 #include "uniqueid.h" 00032 #include <algorithm> 00033 00034 /* === M A C R O S ========================================================= */ 00035 00036 /* === T Y P E D E F S ===================================================== */ 00037 00038 /* === C L A S S E S & S T R U C T S ======================================= */ 00039 00040 namespace synfig { 00041 00042 class BLinePoint : public UniqueID 00043 { 00044 private: 00045 Point vertex_; 00046 Vector tangent_[2]; 00047 float width_; 00048 float origin_; 00049 bool split_tangent_; 00050 00051 public: 00052 00053 BLinePoint(): 00054 vertex_(Point(0,0)), 00055 width_(0.01), 00056 origin_(0.0), 00057 split_tangent_(false) 00058 { tangent_[0] = Point(0,0); tangent_[1] = Point(0,0); } 00059 00060 const Point& get_vertex()const { return vertex_; } 00061 void set_vertex(const Point& x) { vertex_=x; } 00062 00063 00064 const Vector& get_tangent1()const { return tangent_[0]; } 00065 const Vector& get_tangent2()const { return split_tangent_?tangent_[1]:tangent_[0]; } 00066 void set_tangent(const Vector& x) { tangent_[0]=tangent_[1]=x; } 00067 void set_tangent1(const Vector& x) { tangent_[0]=x; } 00068 void set_tangent2(const Vector& x) { tangent_[1]=x; } 00069 00070 00071 const float& get_width()const { return width_; } 00072 void set_width(float x) { width_=x; } 00073 00074 // We store the origin offset by 0.5 so that 00075 // can have the origin set to the default by zeroing 00076 // out the structure. 00077 float get_origin()const { return origin_+0.5f; } 00078 void set_origin(float x) { origin_=x-0.5f; } 00079 00080 00081 const bool& get_split_tangent_flag()const { return split_tangent_; } 00082 void set_split_tangent_flag(bool x=true) { split_tangent_=x; } 00083 00084 void reverse(); 00085 00086 }; // END of class BLinePoint 00087 00088 }; // END of namespace synfig 00089 00090 /* === E N D =============================================================== */ 00091 00092 #endif