Module: synfig/synfig
Branch: genete_width_outline
Commit: b54b3a5f97d3e9d20be95c72a4172f0bdef2fec9
URL:    
http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig/synfig;a=commit;h=b54b3a5f97d3e9d20be95c72a4172f0bdef2fec9

Author: Carlos Lopez <genet...@gmail.com>
Date:   Sat Jan  8 14:13:52 2011 +0100

Use normalised position [0,1] to work and store the position as (-inf, inf)

---

 synfig-core/src/synfig/widthpoint.cpp |   10 ++++++++++
 synfig-core/src/synfig/widthpoint.h   |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/synfig-core/src/synfig/widthpoint.cpp 
b/synfig-core/src/synfig/widthpoint.cpp
index 6d0289c..b42eb1a 100644
--- a/synfig-core/src/synfig/widthpoint.cpp
+++ b/synfig-core/src/synfig/widthpoint.cpp
@@ -68,9 +68,19 @@ WidthPoint::get_position()const
        return position_;
 }
 
+const Real&
+WidthPoint::get_norm_position()const
+{
+       Real ret_pos(fabs(fmod(position_, 1.0f));
+       if(fabs(position_) >= 1.0 && ret_pos==0.0)
+               return 1.0;
+       return ret_pos;
+}
+
 void
 WidthPoint::set_position(const Real& x)
 {
+
        position_=x;
 }
 
diff --git a/synfig-core/src/synfig/widthpoint.h 
b/synfig-core/src/synfig/widthpoint.h
index 1d28ab7..79b0576 100644
--- a/synfig-core/src/synfig/widthpoint.h
+++ b/synfig-core/src/synfig/widthpoint.h
@@ -62,6 +62,8 @@ public:
 
        const Real& get_position()const;
        void set_position(const Real& x);
+       // gets the normalised position: converts it to be inside [0,1]
+       const Real& get_norm_position()const
 
        const Real& get_width()const;
        void set_width(Real x);


------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to