Tiny enhancement of measurement algorithm gives more reliable results on auto-measure for 'any direction'. The solution is taking vertexes into account and accepts them as counterpart for the seed.

This commit is contained in:
Matthias Koefferlein 2019-09-02 22:58:42 +02:00
parent 2e695bd048
commit 25e2151e28
1 changed files with 6 additions and 2 deletions

View File

@ -552,7 +552,7 @@ private:
std::pair<bool, db::DPoint> ip = e.intersect_point (db::DEdge (e1, e2));
if (ip.first) {
find_closest (ip.second, e);
find_closest_exact (ip.second, e);
}
}
@ -770,7 +770,7 @@ do_obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt
db::DPoint dp1 (pt1);
db::DPoint dp2 (pt2);
ContourFinder finder (dp1, grid, cutlines, false /*no vertex snap*/);
ContourFinder finder (dp1, grid, cutlines, cutlines.empty () /*vertex snap on "any direction"*/);
double sr = min_search_range;
while (sr < max_search_range + 1e-6) {
@ -800,6 +800,10 @@ do_obj_snap2 (lay::LayoutView *view, const db::DPoint &pt1, const db::DPoint &pt
}
} else if (finder.is_vertex ()) {
cl.push_back (db::DEdge (p1, dp2));
} else if (finder.has_found_edge ()) {
n = finder.get_found_edge ().d ().transformed (db::DTrans (db::DTrans::r90));