From: <md...@us...> - 2010-08-16 15:06:22
|
Revision: 8634 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8634&view=rev Author: mdboom Date: 2010-08-16 15:06:16 +0000 (Mon, 16 Aug 2010) Log Message: ----------- Handle NaN's correctly in path analysis routines. Fixes a bug where the best location for a legend was not calculated correctly when the line contains NaNs. - MGD Modified Paths: -------------- branches/v1_0_maint/CHANGELOG branches/v1_0_maint/src/_path.cpp Modified: branches/v1_0_maint/CHANGELOG =================================================================== --- branches/v1_0_maint/CHANGELOG 2010-08-16 08:12:28 UTC (rev 8633) +++ branches/v1_0_maint/CHANGELOG 2010-08-16 15:06:16 UTC (rev 8634) @@ -1,3 +1,7 @@ +2010-08-16 Handle NaN's correctly in path analysis routines. Fixes a + bug where the best location for a legend was not calculated + correctly when the line contains NaNs. - MGD + 2010-08-14 Fix bug in patch alpha handling, and in bar color kwarg - EF 2010-07-20 Return Qt4's default cursor when leaving the canvas - DSD Modified: branches/v1_0_maint/src/_path.cpp =================================================================== --- branches/v1_0_maint/src/_path.cpp 2010-08-16 08:12:28 UTC (rev 8633) +++ branches/v1_0_maint/src/_path.cpp 2010-08-16 15:06:16 UTC (rev 8634) @@ -224,7 +224,8 @@ const agg::trans_affine& trans) { typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef agg::conv_curve<transformed_path_t> curve_t; + typedef PathNanRemover<transformed_path_t> no_nans_t; + typedef agg::conv_curve<no_nans_t> curve_t; if (path.total_vertices() < 3) { @@ -232,7 +233,8 @@ } transformed_path_t trans_path(path, trans); - curve_t curved_path(trans_path); + no_nans_t no_nans_path(trans_path, true, path.has_curves()); + curve_t curved_path(no_nans_path); return point_in_path_impl(x, y, curved_path); } @@ -241,11 +243,13 @@ const agg::trans_affine& trans) { typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef agg::conv_curve<transformed_path_t> curve_t; + typedef PathNanRemover<transformed_path_t> no_nans_t; + typedef agg::conv_curve<no_nans_t> curve_t; typedef agg::conv_stroke<curve_t> stroke_t; transformed_path_t trans_path(path, trans); - curve_t curved_path(trans_path); + no_nans_t nan_removed_path(trans_path, true, path.has_curves()); + curve_t curved_path(nan_removed_path); stroke_t stroked_path(curved_path); stroked_path.width(r * 2.0); return point_in_path_impl(x, y, stroked_path); @@ -673,13 +677,15 @@ PathIterator& b, const agg::trans_affine& btrans) { typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef agg::conv_curve<transformed_path_t> curve_t; + typedef PathNanRemover<transformed_path_t> no_nans_t; + typedef agg::conv_curve<no_nans_t> curve_t; if (a.total_vertices() < 3) return false; transformed_path_t b_path_trans(b, btrans); - curve_t b_curved(b_path_trans); + no_nans_t b_no_nans(b_path_trans, true, b.has_curves()); + curve_t b_curved(b_no_nans); double x, y; b_curved.rewind(0); @@ -1169,16 +1175,20 @@ bool path_intersects_path(PathIterator& p1, PathIterator& p2) { - typedef agg::conv_curve<PathIterator> curve_t; + typedef PathNanRemover<PathIterator> no_nans_t; + typedef agg::conv_curve<no_nans_t> curve_t; if (p1.total_vertices() < 2 || p2.total_vertices() < 2) { return false; } - curve_t c1(p1); - curve_t c2(p2); + no_nans_t n1(p1, true, p1.has_curves()); + no_nans_t n2(p2, true, p2.has_curves()); + curve_t c1(n1); + curve_t c2(n2); + double x11, y11, x12, y12; double x21, y21, x22, y22; @@ -1211,6 +1221,7 @@ PathIterator p1(args[0]); PathIterator p2(args[1]); bool filled = false; + if (args.size() == 3) { filled = args[2].isTrue(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |