Revision: 8691 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8691&view=rev Author: mdboom Date: 2010-09-08 15:51:18 +0000 (Wed, 08 Sep 2010)
Log Message: ----------- Another pass at fixing simplification. Modified Paths: -------------- branches/v1_0_maint/lib/matplotlib/tests/baseline_images/test_simplification/fft_peaks.pdf branches/v1_0_maint/lib/matplotlib/tests/baseline_images/test_simplification/fft_peaks.png branches/v1_0_maint/lib/matplotlib/tests/baseline_images/test_simplification/fft_peaks.svg branches/v1_0_maint/lib/matplotlib/tests/test_simplification.py branches/v1_0_maint/src/path_converters.h Modified: branches/v1_0_maint/lib/matplotlib/tests/baseline_images/test_simplification/fft_peaks.pdf =================================================================== (Binary files differ) Modified: branches/v1_0_maint/lib/matplotlib/tests/baseline_images/test_simplification/fft_peaks.png =================================================================== (Binary files differ) Modified: branches/v1_0_maint/lib/matplotlib/tests/baseline_images/test_simplification/fft_peaks.svg =================================================================== --- branches/v1_0_maint/lib/matplotlib/tests/baseline_images/test_simplification/fft_peaks.svg 2010-09-08 14:32:17 UTC (rev 8690) +++ branches/v1_0_maint/lib/matplotlib/tests/baseline_images/test_simplification/fft_peaks.svg 2010-09-08 15:51:18 UTC (rev 8691) @@ -11,12 +11,12 @@ <g id="figure1"> <g id="patch1"> <path style="fill: #ffffff; stroke: #ffffff; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M0.000000 432.000000L576.000000 432.000000L576.000000 0.000000 -L0.000000 0.000000L0.000000 432.000000"/> +L0.000000 0.000000z"/> </g> <g id="axes1"> <g id="patch2"> <path style="fill: #ffffff; opacity: 1.000000" d="M72.000000 388.800000L518.400000 388.800000L518.400000 43.200000 -L72.000000 43.200000L72.000000 388.800000"/> +L72.000000 43.200000z"/> </g> <g id="line2d1"> <defs> @@ -25,9 +25,10 @@ </clipPath> </defs><path style="fill: none; stroke: #0000ff; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" clip-path="url(#p50431ccdcb28178602d99d9270004dde)" d="M72.000000 388.800000L76.132389 388.704243L76.151520 388.455734 L76.157897 388.474541L76.170651 262.490246L76.177029 70.552590 -L76.272686 388.786908L76.629806 388.799881L221.059337 388.800000 -L485.704389 388.713691L485.729897 388.401770L485.736274 386.681411 -L485.755406 70.552590L485.844686 388.786149L486.182674 388.799863 +L76.183406 112.959876L76.183406 112.959876L76.298194 388.793604 +L77.114469 388.799987L485.704389 388.713691L485.729897 388.401770 +L485.736274 386.681411L485.755406 70.552590L485.768160 379.474263 +L485.768160 379.474263L485.882949 388.795086L487.018080 388.799995 L489.926057 388.800000L489.926057 388.800000"/> </g> <g id="matplotlib.axis1"> Modified: branches/v1_0_maint/lib/matplotlib/tests/test_simplification.py =================================================================== --- branches/v1_0_maint/lib/matplotlib/tests/test_simplification.py 2010-09-08 14:32:17 UTC (rev 8690) +++ branches/v1_0_maint/lib/matplotlib/tests/test_simplification.py 2010-09-08 15:51:18 UTC (rev 8691) @@ -141,7 +141,7 @@ print len(simplified) - assert len(simplified) == 17 + assert len(simplified) == 20 def test_start_with_moveto(): # Should be entirely clipped away to a single MOVETO @@ -212,8 +212,8 @@ @image_comparison(baseline_images=['para_equal_perp']) def test_para_equal_perp(): - x = np.array([0, 1, 2, 1, 0, -1, 0, 1]) - y = np.array([1, 1, 2, 1, 0, -1, 0, 0]) + x = np.array([0, 1, 2, 1, 0, -1, 0, 1] + [1] * 128) + y = np.array([1, 1, 2, 1, 0, -1, 0, 0] + [0] * 128) fig = plt.figure() ax = fig.add_subplot(111) Modified: branches/v1_0_maint/src/path_converters.h =================================================================== --- branches/v1_0_maint/src/path_converters.h 2010-09-08 14:32:17 UTC (rev 8690) +++ branches/v1_0_maint/src/path_converters.h 2010-09-08 15:51:18 UTC (rev 8691) @@ -520,7 +520,7 @@ m_moveto(true), m_after_moveto(false), m_lastx(0.0), m_lasty(0.0), m_clipped(false), m_origdx(0.0), m_origdy(0.0), - m_origdNorm2(0.0), m_dnorm2Max(0.0), m_dnorm2Min(0.0), + m_origdNorm2(0.0), m_dnorm2Max(0.0), m_lastMax(false), m_nextX(0.0), m_nextY(0.0), m_lastWrittenX(0.0), m_lastWrittenY(0.0) { @@ -637,7 +637,6 @@ //set all the variables to reflect this new orig vector m_dnorm2Max = m_origdNorm2; - m_dnorm2Min = 0.0; m_lastMax = true; m_nextX = m_lastWrittenX = m_lastx = *x; @@ -677,36 +676,25 @@ /* check if the current vector is parallel or anti-parallel to the orig vector. If it is parallel, test if it is the longest of the vectors - we are merging in that direction. If anti-p, test - if it is the longest in the opposite direction (the - min of our final line) */ + we are merging in that direction. */ double paradNorm2 = paradx * paradx + parady * parady; - if (perpdNorm2 == paradNorm2) { + m_lastMax = false; + if (totdot > 0.0) + { + if (paradNorm2 > m_dnorm2Max) + { + m_lastMax = true; + m_dnorm2Max = paradNorm2; + m_nextX = *x; + m_nextY = *y; + } + } + else + { _push(&m_lastx, &m_lasty); _push(x, y); break; - } else { - m_lastMax = false; - if (totdot >= 0.0) - { - if (paradNorm2 > m_dnorm2Max) - { - m_lastMax = true; - m_dnorm2Max = paradNorm2; - m_nextX = *x; - m_nextY = *y; - } - } - else - { - if (paradNorm2 < m_dnorm2Min) - { - m_dnorm2Min = paradNorm2; - m_nextX = *x; - m_nextY = *y; - } - } } m_lastx = *x; @@ -770,7 +758,6 @@ double m_origdy; double m_origdNorm2; double m_dnorm2Max; - double m_dnorm2Min; bool m_lastMax; double m_nextX; double m_nextY; @@ -805,7 +792,6 @@ m_origdNorm2 = m_origdx * m_origdx + m_origdy * m_origdy; m_dnorm2Max = m_origdNorm2; - m_dnorm2Min = 0.0; m_lastMax = true; m_lastWrittenX = m_queue[m_queue_write-1].x; m_lastWrittenY = m_queue[m_queue_write-1].y; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins