Author: Carlos Lopez <genet...@gmail.com> Date: Mon Apr 18 10:42:02 2011 +0200
Calculate properly the blinepoints position over the bline. Previously using the sum of the bezier's size caused a floating point error at the last blinepoint obtaining 0.99999999999999999 instead of 1.0 placing the blinepoint not exactly at the end of the bline. This caused enless loops in some particular cases of number of blinepoints. Using multiplication instead of sum, solved the problem. --- .../src/modules/mod_geometry/advanced_outline.cpp | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/synfig-core/src/modules/mod_geometry/advanced_outline.cpp b/synfig-core/src/modules/mod_geometry/advanced_outline.cpp index 9c0d465..863697c 100644 --- a/synfig-core/src/modules/mod_geometry/advanced_outline.cpp +++ b/synfig-core/src/modules/mod_geometry/advanced_outline.cpp @@ -144,7 +144,10 @@ Advanced_Outline::sync() // when doing the cusp at the first blinepoint of the current bezier Vector last_tangent; Real bezier_size = 1.0/(blineloop?bline_size:(bline_size==1?1.0:(bline_size-1))); - Real biter_pos(0.0), bnext_pos(bezier_size); + Real bindex(0.0); + Real biter_pos(bindex*bezier_size); + bindex++; + Real bnext_pos(bindex*bezier_size); const vector<BLinePoint>::const_iterator bend(bline.end()); vector<Point> side_a, side_b; // Sort the wplist. It is needed to calculate the first widthpoint @@ -356,7 +359,8 @@ Advanced_Outline::sync() bnext++; // Update blinepoints positions biter_pos = bnext_pos; - bnext_pos+=bezier_size; + bindex++; + bnext_pos=bindex*bezier_size; } // continue with the main loop continue; @@ -420,7 +424,8 @@ Advanced_Outline::sync() bnext++; // Update blinepoints positions biter_pos = bnext_pos; - bnext_pos+=bezier_size; + bindex++; + bnext_pos=bindex*bezier_size; // remember last tangent value last_tangent=deriv(1.0-CUSP_TANGENT_ADJUST); break; ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ Synfig-devl mailing list Synfig-devl@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/synfig-devl