Skip to content

Commit

Permalink
Refined solution for #198
Browse files Browse the repository at this point in the history
  • Loading branch information
klayoutmatthias committed Nov 24, 2018
1 parent cc04594 commit 42774f6
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/db/db/dbEdgesToContours.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class point_matcher
{
public:

point_matcher () : m_vp_min (0.0), m_d_min (0.0), m_any (false), m_any_coincident (false)
point_matcher () : m_vp_min (0.0), m_d_min (0.0), m_any (false)
{
// .. nothing yet ..
}
Expand All @@ -133,40 +133,40 @@ class point_matcher
typedef db::coord_traits<C> coord_traits;

double d = p.double_distance (swapped ? other.p2 () : other.p1 ());
bool coincident = d < coord_traits::prec ();
double vp = db::vprod (other.d (), e.d ()) * (1.0 / other.d ().double_length ());

if (coincident) {
if (! m_any) {

m_vp_min = vp;
m_d_min = d;
m_any = true;
return true;

} else if (fabs (d - m_d_min) < coord_traits::prec ()) {

double vp = db::vprod (other.d (), e.d ()) * (1.0 / other.d ().double_length ());
if (! m_any_coincident || vp < m_vp_min) {
m_any_coincident = true;
if (vp < m_vp_min) {
m_vp_min = vp;
m_d_min = 0.0;
return true;
} else {
return false;
}

} else if (! m_any_coincident) {
} else if (d < m_d_min) {

if (! m_any || d < m_d_min) {
m_any = true;
m_d_min = d;
return true;
} else {
return false;
}
m_vp_min = vp;
m_d_min = d;
return true;

} else {
return false;
}

}

private:
double m_vp_min;
double m_d_min;
bool m_any, m_any_coincident;
bool m_any;
};

}
Expand Down

0 comments on commit 42774f6

Please sign in to comment.