From 25e2151e281ff407d144aa1ee6d8fcf9b2c57ea1 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 2 Sep 2019 22:58:42 +0200 Subject: [PATCH] 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. --- src/laybasic/laybasic/laySnap.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/laybasic/laybasic/laySnap.cc b/src/laybasic/laybasic/laySnap.cc index 3c2c3bd12..0989441d4 100644 --- a/src/laybasic/laybasic/laySnap.cc +++ b/src/laybasic/laybasic/laySnap.cc @@ -552,7 +552,7 @@ private: std::pair 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));