mirror of https://github.com/KLayout/klayout.git
Fixed #74 (small-corner boolean issue). Tests need update
This commit is contained in:
parent
363c0c9fed
commit
6df645a917
|
|
@ -1349,13 +1349,17 @@ get_intersections_per_band_any (std::vector <CutPoints> &cutpoints, std::vector
|
|||
// the cutpoint will be a weak attractor - that is an optional cutpoint.
|
||||
// In that case we can skip the cutpoint because no related edge will move.
|
||||
ip_weak.clear ();
|
||||
size_t n_off_edge = on_edge1 ? 0 : 1;
|
||||
for (std::vector <WorkEdge>::iterator cc = c; cc != f; ++cc) {
|
||||
if ((with_h || cc->dy () != 0) && cc != c1 && cc != c2 && is_point_on_fuzzy (*cc, cp.second)) {
|
||||
ip_weak.push_back (&*cc);
|
||||
if (!is_point_on_exact (*cc, cp.second)) {
|
||||
++n_off_edge;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std::vector <WorkEdge *>::iterator icc = ip_weak.begin (); icc != ip_weak.end (); ++icc) {
|
||||
if (ip_weak.size () > 1 || !on_edge1) {
|
||||
if (n_off_edge > 1) {
|
||||
(*icc)->make_cutpoints (cutpoints)->add (cp.second, &cutpoints, true);
|
||||
#ifdef DEBUG_EDGE_PROCESSOR
|
||||
printf ("intersection point %s gives cutpoint in %s.\n", cp.second.to_string ().c_str (), (*icc)->to_string ().c_str ());
|
||||
|
|
@ -1435,13 +1439,23 @@ get_intersections_per_band_any (std::vector <CutPoints> &cutpoints, std::vector
|
|||
// the cutpoint will be a weak attractor - that is an optional cutpoint.
|
||||
// In that case we can skip the cutpoint because no related edge will move.
|
||||
ip_weak.clear ();
|
||||
size_t n_off_edge = 0;
|
||||
if (!on_edge1) {
|
||||
n_off_edge += 1;
|
||||
}
|
||||
if (!on_edge2) {
|
||||
n_off_edge += 1;
|
||||
}
|
||||
for (std::vector <WorkEdge>::iterator cc = c; cc != f; ++cc) {
|
||||
if ((with_h || cc->dy () != 0) && cc != c1 && cc != c2 && is_point_on_fuzzy (*cc, cp.second)) {
|
||||
ip_weak.push_back (&*cc);
|
||||
if (!is_point_on_exact (*cc, cp.second)) {
|
||||
++n_off_edge;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std::vector <WorkEdge *>::iterator icc = ip_weak.begin (); icc != ip_weak.end (); ++icc) {
|
||||
if (ip_weak.size () > 1 || !on_edge1 || !on_edge2) {
|
||||
if (n_off_edge > 1) {
|
||||
(*icc)->make_cutpoints (cutpoints)->add (cp.second, &cutpoints, true);
|
||||
#ifdef DEBUG_EDGE_PROCESSOR
|
||||
printf ("intersection point %s gives cutpoint in %s.\n", cp.second.to_string ().c_str (), (*icc)->to_string ().c_str ());
|
||||
|
|
|
|||
|
|
@ -2244,3 +2244,54 @@ TEST(100)
|
|||
db::compare_layouts (_this, lr, au_fn);
|
||||
}
|
||||
|
||||
// #74 (GitHub)
|
||||
TEST(101)
|
||||
{
|
||||
db::EdgeProcessor ep;
|
||||
|
||||
{
|
||||
db::Point pts[] = {
|
||||
db::Point (0, 0),
|
||||
db::Point (0, 10),
|
||||
db::Point (10, 10),
|
||||
db::Point (10, 0)
|
||||
};
|
||||
db::Polygon p;
|
||||
p.assign_hull (&pts[0], &pts[sizeof(pts) / sizeof(pts[0])]);
|
||||
ep.insert (p, 0);
|
||||
}
|
||||
|
||||
{
|
||||
db::Point pts[] = {
|
||||
db::Point (-1, -1),
|
||||
db::Point (-1, 8),
|
||||
db::Point (2, 11),
|
||||
db::Point (2, -1)
|
||||
};
|
||||
db::Polygon p;
|
||||
p.assign_hull (&pts[0], &pts[sizeof(pts) / sizeof(pts[0])]);
|
||||
ep.insert (p, 1);
|
||||
}
|
||||
|
||||
{
|
||||
db::Point pts[] = {
|
||||
db::Point (2, -1),
|
||||
db::Point (2, 11),
|
||||
db::Point (11, 11),
|
||||
db::Point (11, -1)
|
||||
};
|
||||
db::Polygon p;
|
||||
p.assign_hull (&pts[0], &pts[sizeof(pts) / sizeof(pts[0])]);
|
||||
ep.insert (p, 1);
|
||||
}
|
||||
|
||||
std::vector<db::Polygon> out;
|
||||
db::PolygonContainer pc (out);
|
||||
db::PolygonGenerator pg (pc, false, true);
|
||||
db::BooleanOp op (db::BooleanOp::And);
|
||||
|
||||
ep.process (pg, op);
|
||||
|
||||
EXPECT_EQ (out.size (), size_t (1));
|
||||
EXPECT_EQ (out[0].to_string (), "(0,0;0,9;1,10;10,10;10,0)");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue