moreupdates
[synfig.git] / synfig-core / trunk / src / synfig / blinepoint.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file blinepoint.h
3 **      \brief Template Header
4 **
5 **      $Id: blinepoint.h,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_BLINEPOINT_H
25 #define __SYNFIG_BLINEPOINT_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include "vector.h"
30 #include "uniqueid.h"
31 #include <algorithm>
32
33 /* === M A C R O S ========================================================= */
34
35 /* === T Y P E D E F S ===================================================== */
36
37 /* === C L A S S E S & S T R U C T S ======================================= */
38
39 namespace synfig {
40
41 class BLinePoint : public UniqueID
42 {
43 private:
44         Point   vertex_;
45         Vector  tangent_[2];
46         float   width_;
47         float   origin_;
48         bool    split_tangent_;
49
50 public:
51
52         BLinePoint():
53                 vertex_(Point(0,0)),
54                 width_(0.01),
55                 origin_(0.0),
56                 split_tangent_(false)
57         { }
58
59         const Point& get_vertex()const { return vertex_; }
60         void set_vertex(const Point& x) { vertex_=x; }
61
62
63         const Vector& get_tangent1()const { return tangent_[0]; }
64         const Vector& get_tangent2()const { return split_tangent_?tangent_[1]:tangent_[0]; }
65         void set_tangent(const Vector& x) { tangent_[0]=tangent_[1]=x; }
66         void set_tangent1(const Vector& x) { tangent_[0]=x; }
67         void set_tangent2(const Vector& x) { tangent_[1]=x; }
68
69
70         const float& get_width()const { return width_; }
71         void set_width(float x) { width_=x; }
72
73         // We store the origin offset by 0.5 so that
74         // can have the origin set to the default by zeroing
75         // out the structure.
76         float get_origin()const { return origin_+0.5f; }
77         void set_origin(float x) { origin_=x-0.5f; }
78
79
80         const bool& get_split_tangent_flag()const { return split_tangent_; }
81         void set_split_tangent_flag(bool x=true) { split_tangent_=x; }
82
83         void reverse();
84         
85 }; // END of class BLinePoint
86         
87 }; // END of namespace synfig
88
89 /* === E N D =============================================================== */
90
91 #endif