8000 Minimum working code - stil needs work · matplotlib/matplotlib@1549197 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1549197

Browse files
committed
Minimum working code - stil needs work
Specifically, filter performing downsampling to * cases where the rc param says to do it * when the affine transformation has an inverse (anyway around this?) * line/marker type is right (solid line, no marker?)
1 parent b1fac50 commit 1549197

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/matplotlib/lines.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,6 @@ def draw(self, renderer):
774774
funcname = self._lineStyles.get(self._linestyle, '_draw_nothing')
775775
if funcname != '_draw_nothing':
776776
tpath, affine = transf_path.get_transformed_path_and_affine()
777-
print(tpath.vertices.size)
778-
print(tpath.cleaned(simplify=True).vertices.size)
779777
if len(tpath.vertices):
780778
line_func = getattr(self, funcname)
781779
gc = renderer.new_gc()
@@ -792,6 +790,9 @@ def draw(self, renderer):
792790
cap = self._dashcapstyle
793791
join = self._dashjoinstyle
794792
else:
793+
print(tpath.vertices.size)
794+
tpath = affine.inverted().transform_path(affine.transform_path(tpath).cleaned(simplify=True))
795+
print(tpath.vertices.size)
795796
cap = self._solidcapstyle
796797
join = self._solidjoinstyle
797798
gc.set_joinstyle(join)
@@ -800,7 +801,7 @@ def draw(self, renderer):
800801
if self.get_sketch_params() is not None:
801802
gc.set_sketch_params(*self.get_sketch_params())
802803

803-
line_func(renderer, gc, tpath.cleaned(simplify=True), affine.frozen())
804+
line_func(renderer, gc, tpath, affine.frozen())
804805
gc.restore()
805806

806807
if self._marker and self._markersize > 0:

src/path_converters.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ class PathSimplifier : protected EmbeddedQueue<9>
638638
to the outbound queue, not to run through the entire path
639639
in one go. This eliminates the need to allocate and fill
640640
an entire additional path array on each draw. */
641+
m_dnorm2BackwardMax = 0.0;
641642
while ((cmd = m_source->vertex(x, y)) != agg::path_cmd_stop) {
642643
/* if we are starting a new path segment, move to the first point
643644
+ init */
@@ -692,6 +693,7 @@ class PathSimplifier : protected EmbeddedQueue<9>
692693

693694
// set all the variables to reflect this new orig vector
694695
m_dnorm2ForwardMax = m_origdNorm2;
696+
m_dnorm2BackwardMax = 0.0;
695697
m_lastForwardMax = true;
696698

697699
m_nextX = m_lastWrittenX = m_lastx = *x;
@@ -726,9 +728,7 @@ class PathSimplifier : protected EmbeddedQueue<9>
726728

727729
/* If the perp vector is less than some number of (squared)
728730
pixels in size, then merge the current vector */
729-
// std::cout << "here?\n";
730731
if (perpdNorm2 < m_simplify_threshold) {
731-
// std::cout << "do we get here?\n";
732732
/* check if the current vector is parallel or
733733
anti-parallel to the orig vector. If it is
734734
parallel, test if it is the longest of the vectors
@@ -745,9 +745,8 @@ class PathSimplifier : protected EmbeddedQueue<9>
745745
m_nextY = *y;
746746
}
747747
} else {
748-
std::cout << "almost next backwards\n";
749748
if (paradNorm2 > m_dnorm2BackwardMax) {
750-
std::cout << "next backwards\n";
749+
// std::cout << "next backwards\n";
751750
m_lastBackwardMax = true;
752751
m_dnorm2BackwardMax = paradNorm2;
753752
m_nextBackwardX = *x;
@@ -767,6 +766,7 @@ class PathSimplifier : protected EmbeddedQueue<9>
767766
/* If the line needs to extend in the opposite direction from the
768767
direction we are drawing in, move back to we start drawing from
769768
back there. */
769+
// std::cout << "at this push " << m_dnorm2BackwardMax;
770770
_push(x, y);
771771

772772
break;
@@ -829,7 +829,7 @@ class PathSimplifier : protected EmbeddedQueue<9>
829829
/* If we observed any backward (anti-parallel) vectors, then
830830
we need to move to the furthest backward point. */
831831
if (m_dnorm2BackwardMax > 0.0) {
832-
std::cout << "pushing backwards\n";
832+
// std::cout << "pushing backward points\n";
833833
queue_push(agg::path_cmd_line_to, m_nextBackwardX, m_nextBackwardY);
834834
}
835835

0 commit comments

Comments
 (0)
0