mirror of https://github.com/KLayout/klayout.git
WIP: try to avoid duplicate intersection points by eliminating those. Problem persists: intersection points may be duplicates of edges arising from AND
This commit is contained in:
parent
24759c7174
commit
9af662a512
|
|
@ -24,6 +24,7 @@
|
||||||
#define HDR_dbEdgeBoolean
|
#define HDR_dbEdgeBoolean
|
||||||
|
|
||||||
#include "dbEdge.h"
|
#include "dbEdge.h"
|
||||||
|
#include "dbHash.h"
|
||||||
#include "dbBoxScanner.h"
|
#include "dbBoxScanner.h"
|
||||||
|
|
||||||
#include "tlIntervalMap.h"
|
#include "tlIntervalMap.h"
|
||||||
|
|
@ -251,7 +252,7 @@ struct EdgeBooleanClusterCollector
|
||||||
} else if (mp_intersections && p1 != p2) {
|
} else if (mp_intersections && p1 != p2) {
|
||||||
|
|
||||||
std::pair<bool, db::Point> ip = o1->intersect_point (*o2);
|
std::pair<bool, db::Point> ip = o1->intersect_point (*o2);
|
||||||
if (ip.first) {
|
if (ip.first && m_seen_intersections.insert (ip.second).second) {
|
||||||
mp_intersections->insert (db::Edge (ip.second, ip.second));
|
mp_intersections->insert (db::Edge (ip.second, ip.second));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,6 +261,7 @@ struct EdgeBooleanClusterCollector
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OutputContainer *mp_intersections;
|
OutputContainer *mp_intersections;
|
||||||
|
std::unordered_set<db::Point> m_seen_intersections;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -852,6 +852,9 @@ TEST(22)
|
||||||
ee.insert (db::Edge (4000,-2000,-2000,-2000));
|
ee.insert (db::Edge (4000,-2000,-2000,-2000));
|
||||||
|
|
||||||
EXPECT_EQ ((e & ee).to_string (), "(400,0;-2000,0);(500,-174;400,0);(1000,0;900,-173);(4000,0;1000,0)");
|
EXPECT_EQ ((e & ee).to_string (), "(400,0;-2000,0);(500,-174;400,0);(1000,0;900,-173);(4000,0;1000,0)");
|
||||||
|
EXPECT_EQ (e.intersections (ee).to_string (), "(400,0;400,0);(-2000,0;-2000,0);(1000,0;1000,0);(4000,0;4000,0);(400,0;-2000,0);(500,-174;400,0);(1000,0;900,-173);(4000,0;1000,0)");
|
||||||
|
// no particular new points with intersections - just endpoints of original edges
|
||||||
|
EXPECT_EQ (e.intersections (ee).merged ().to_string (), "(400,0;-2000,0);(500,-174;400,0);(1000,0;900,-173);(4000,0;1000,0)");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(23)
|
TEST(23)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue