@@ -520,7 +520,7 @@ class PathSimplifier : protected EmbeddedQueue<9>
520520 m_moveto (true ), m_after_moveto(false ),
521521 m_lastx (0.0 ), m_lasty(0.0 ), m_clipped(false ),
522522 m_origdx (0.0 ), m_origdy(0.0 ),
523- m_origdNorm2 (0.0 ), m_dnorm2Max(0.0 ), m_dnorm2Min( 0.0 ),
523+ m_origdNorm2 (0.0 ), m_dnorm2Max(0.0 ),
524524 m_lastMax (false ), m_nextX(0.0 ), m_nextY(0.0 ),
525525 m_lastWrittenX (0.0 ), m_lastWrittenY(0.0 )
526526 {
@@ -637,7 +637,6 @@ class PathSimplifier : protected EmbeddedQueue<9>
637637
638638 // set all the variables to reflect this new orig vector
639639 m_dnorm2Max = m_origdNorm2;
640- m_dnorm2Min = 0.0 ;
641640 m_lastMax = true ;
642641
643642 m_nextX = m_lastWrittenX = m_lastx = *x;
@@ -677,36 +676,25 @@ class PathSimplifier : protected EmbeddedQueue<9>
677676 /* check if the current vector is parallel or
678677 anti-parallel to the orig vector. If it is
679678 parallel, test if it is the longest of the vectors
680- we are merging in that direction. If anti-p, test
681- if it is the longest in the opposite direction (the
682- min of our final line) */
679+ we are merging in that direction. */
683680 double paradNorm2 = paradx * paradx + parady * parady;
684681
685- if (perpdNorm2 == paradNorm2) {
682+ m_lastMax = false ;
683+ if (totdot > 0.0 )
684+ {
685+ if (paradNorm2 > m_dnorm2Max)
686+ {
687+ m_lastMax = true ;
688+ m_dnorm2Max = paradNorm2;
689+ m_nextX = *x;
690+ m_nextY = *y;
691+ }
692+ }
693+ else
694+ {
686695 _push (&m_lastx, &m_lasty);
687696 _push (x, y);
688697 break ;
689- } else {
690- m_lastMax = false ;
691- if (totdot >= 0.0 )
692- {
693- if (paradNorm2 > m_dnorm2Max)
694- {
695- m_lastMax = true ;
696- m_dnorm2Max = paradNorm2;
697- m_nextX = *x;
698- m_nextY = *y;
699- }
700- }
701- else
702- {
703- if (paradNorm2 < m_dnorm2Min)
704- {
705- m_dnorm2Min = paradNorm2;
706- m_nextX = *x;
707- m_nextY = *y;
708- }
709- }
710698 }
711699
712700 m_lastx = *x;
@@ -770,7 +758,6 @@ class PathSimplifier : protected EmbeddedQueue<9>
770758 double m_origdy;
771759 double m_origdNorm2;
772760 double m_dnorm2Max;
773- double m_dnorm2Min;
774761 bool m_lastMax;
775762 double m_nextX;
776763 double m_nextY;
@@ -805,7 +792,6 @@ class PathSimplifier : protected EmbeddedQueue<9>
805792 m_origdNorm2 = m_origdx * m_origdx + m_origdy * m_origdy;
806793
807794 m_dnorm2Max = m_origdNorm2;
808- m_dnorm2Min = 0.0 ;
809795 m_lastMax = true ;
810796 m_lastWrittenX = m_queue[m_queue_write-1 ].x ;
811797 m_lastWrittenY = m_queue[m_queue_write-1 ].y ;
0 commit comments