Author: Carlos Lopez <[email protected]>
Date: Thu Oct 20 17:58:59 2011 +0200
Fix and simplify get_norm_position widthpoint member
---
synfig-core/src/synfig/widthpoint.cpp | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/synfig-core/src/synfig/widthpoint.cpp
b/synfig-core/src/synfig/widthpoint.cpp
index fc3f03c..8144f9b 100644
--- a/synfig-core/src/synfig/widthpoint.cpp
+++ b/synfig-core/src/synfig/widthpoint.cpp
@@ -78,23 +78,19 @@ WidthPoint::get_position()const
Real
WidthPoint::get_norm_position(bool wplistloop)const
{
- Real pos(get_position());
- Real ret(pos-lower_bound_);
+ Real ret(get_position()-lower_bound_);
Real range(upper_bound_-lower_bound_);
- if(wplistloop)
+ if(!wplistloop)
{
- ret=fmod(ret, range);
- ret=ret>=0.0?ret:(range+ret);
- ret+=lower_bound_;
+ if (ret < 0) ret = 0;
+ if (ret > range) ret = range;
}
else
{
- if (pos < lower_bound_) ret = lower_bound_;
- if (pos > upper_bound_) ret = upper_bound_;
+ ret=fmod(ret, range);
+ ret=ret>=0.0?ret:(range+ret);
}
- // now canonicalize the position to be inside (0.0, 1.0)
- ret=(ret-lower_bound_)/range;
- return ret;
+ return ret/range;
}
void
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl