From a71d5894aa4fd3833c5faf205fa98fbd315201ed Mon Sep 17 00:00:00 2001 From: EvilSpirit Date: Fri, 8 Jan 2016 11:20:37 +0600 Subject: [PATCH] Draw extension lines from pt-line-distance to line ends. Before this commit, if a pt-line-distance constraint is placed so that the dimension line doesn't touch the line, no extension is drawn. After this commit, an extension line will be drawn towards the nearest end of the line. --- src/drawconstraint.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/drawconstraint.cpp b/src/drawconstraint.cpp index b61a0cc..6f61149 100644 --- a/src/drawconstraint.cpp +++ b/src/drawconstraint.cpp @@ -490,6 +490,19 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) { if(!pt.Equals(closest)) { DoLineWithArrows(ref, pt, closest, true); + + // Extensions to line + double pixels = 1.0 / SS.GW.scale; + Vector refClosest = ref.ClosestPointOnLine(lA, dl); + double ddl = dl.Dot(dl); + if(fabs(ddl) > LENGTH_EPS * LENGTH_EPS) { + double t = refClosest.Minus(lA).Dot(dl) / ddl; + if(t < 0.0) { + LineDrawOrGetDistance(refClosest.Minus(dl.WithMagnitude(10.0 * pixels)), lA); + } else if(t > 1.0) { + LineDrawOrGetDistance(refClosest.Plus(dl.WithMagnitude(10.0 * pixels)), lB); + } + } } if(workplane.v != Entity::FREE_IN_3D.v) {