Author: Carlos Lopez <[email protected]>
Date: Fri Oct 7 11:04:31 2011 +0200
Clear the items first. Add some debug info. Place the includes in the right
place. Correct the assignment of width and position for the initial Widthpoints
---
synfig-studio/src/synfigapp/wplistconverter.cpp | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/synfig-studio/src/synfigapp/wplistconverter.cpp
b/synfig-studio/src/synfigapp/wplistconverter.cpp
index 0cd9dc5..77d57e5 100644
--- a/synfig-studio/src/synfigapp/wplistconverter.cpp
+++ b/synfig-studio/src/synfigapp/wplistconverter.cpp
@@ -31,11 +31,10 @@
# include <config.h>
#endif
-#endif
-
#include "wplistconverter.h"
#include <synfig/valuenode_wplist.h>
+#endif
/* === U S I N G =========================================================== */
@@ -74,6 +73,8 @@ WPListConverter::operator()(std::list<synfig::WidthPoint>
&wp_out, const std::li
synfig::info("sizes don't match Points size = %d , Widths size
= %d", p.size(), w.size());
return;
}
+ clear();
+ synfig::info("vectors cleared");
// Remove duplicated
std::list<synfig::Point>::const_iterator p_iter = p.begin(), end =
p.end();
std::list<synfig::Real>::const_iterator w_iter = w.begin();
@@ -81,12 +82,15 @@ WPListConverter::operator()(std::list<synfig::WidthPoint>
&wp_out, const std::li
points.push_back(c);
widths.push_back(*w_iter);
p_iter++;
+ synfig::info("initial size: %d", p.size());
for(;p_iter != end; ++p_iter,++w_iter)
if (*p_iter != c)
{
points.push_back(c = *p_iter);
widths.push_back(*w_iter);
+ synfig::info("point x=%f y=%f width %f",
(*p_iter)[0], (*p_iter)[1], *w_iter);
}
+ synfig::info("after removed duplicated size: %d", points.size());
// once removed the duplicated then get the sizes of the work vectors
n=points.size();
nf=Real(n);
@@ -100,12 +104,14 @@ WPListConverter::operator()(std::list<synfig::WidthPoint>
&wp_out, const std::li
d+=(p2-p1).mag();
distances.push_back(d);
p1=p2;
+ synfig::info("i=%d, cumulative distance=%f", i, d);
}
synfig::info("distances size = %d", distances.size());
// Calculate the normalized cumulative distances
for(i=0;i<n;i++)
{
- norm_distances.push_back(distances[i]/distances[n]);
+ norm_distances.push_back(distances[i]/distances[n-1]);
+ synfig::info("i=%d, norm dist = %f", i, norm_distances.back());
}
// Prepare the output
work_out.resize(n);
@@ -117,7 +123,10 @@ WPListConverter::operator()(std::list<synfig::WidthPoint>
&wp_out, const std::li
// Only setting dash to false will validate the widhtpoint based on the
// error rules.
for(i=0; i<n; i++)
- work_out[i]=WidthPoint(widths[i], norm_distances[i],
WidthPoint::TYPE_INTERPOLATE, WidthPoint::TYPE_INTERPOLATE, true);
+ {
+ work_out[i]=WidthPoint(norm_distances[i], widths[i],
WidthPoint::TYPE_INTERPOLATE, WidthPoint::TYPE_INTERPOLATE, true);
+ synfig::info("initial %d : W=%f, P=%f", i,
work_out[i].get_width(), work_out[i].get_position());
+ }
// Now let's insert the first two widthpoints:
k1=0;
k2=n-1;
@@ -127,16 +136,19 @@ WPListConverter::operator()(std::list<synfig::WidthPoint>
&wp_out, const std::li
se=-1.0;
// Calculate kem, ek, ek2 for the first time.
kem=calculate_ek2(k1, k2, true);
+ synfig::info("kem %d", kem);
while(se>err2max)
{
k1=find_prev(kem);
k2=find_next(kem);
+ synfig::info("new k1 %d, k2 %d", k1, k2);
if(k1==k2 || k1+1==k2)
break;
// Insert a width point at kem
work_out[kem].set_dash(false);
// Calculate the errors again
kem=calculate_ek2(k1, k2);
+ synfig::info("new kem %d", kem);
}
wp_out.assign(work_out.begin(), work_out.end());
}
@@ -149,6 +161,7 @@ WPListConverter::calculate_ek2(unsigned int k1, unsigned
int k2, bool first_time
Real curr_max_err2(0);
unsigned int ret_kem;
WidthPoint wp_prev, wp_next;
+ synfig::info("current se %f", se);
if(!first_time)
se=se*n;
else
@@ -166,6 +179,7 @@ WPListConverter::calculate_ek2(unsigned int k1, unsigned
int k2, bool first_time
}
else
g=widths[i]-work_out[i].get_width(); // should be zero.
+ synfig::info("g=%f", g);
gg=g*g;
if(!first_time)
{
@@ -188,6 +202,7 @@ WPListConverter::calculate_ek2(unsigned int k1, unsigned
int k2, bool first_time
curr_max_err2=ek2[i];
}
}
+ synfig::info("new se %f", se);
return ret_kem;
}
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl