From: <md...@us...> - 2010-08-16 15:07:04
|
Revision: 8635 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8635&view=rev Author: mdboom Date: 2010-08-16 15:06:58 +0000 (Mon, 16 Aug 2010) Log Message: ----------- Merged revisions 8634 via svnmerge from https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v1_0_maint ........ r8634 | mdboom | 2010-08-16 11:06:16 -0400 (Mon, 16 Aug 2010) | 4 lines 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: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/src/_path.cpp Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /branches/v1_0_maint:1-8632 /trunk/matplotlib:1-7315 + /branches/mathtex:1-7263 /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7253 /branches/v1_0_maint:1-8634 /trunk/matplotlib:1-7315 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2010-08-16 15:06:16 UTC (rev 8634) +++ trunk/matplotlib/CHANGELOG 2010-08-16 15:06:58 UTC (rev 8635) @@ -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-08-12 Removed all traces of numerix module after 17 months of Modified: trunk/matplotlib/src/_path.cpp =================================================================== --- trunk/matplotlib/src/_path.cpp 2010-08-16 15:06:16 UTC (rev 8634) +++ trunk/matplotlib/src/_path.cpp 2010-08-16 15:06:58 UTC (rev 8635) @@ -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. |