From 084c4836036c32beb4376b6ca2e0d83c5d82efb9 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Fri, 9 Nov 2018 16:00:09 +0100 Subject: [PATCH] Sketcher: Ellipse trim, handle multiple intersection --- src/Mod/Sketcher/App/SketchObject.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 46701fa4d9..9c795c9807 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -2159,6 +2159,17 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) } }; + auto handlemultipleintersection = [this] (Constraint * constr, int GeoId, PointPos pos, PointPos & secondPos) { + + Base::Vector3d cp = getPoint(constr->First,constr->FirstPos); + + Base::Vector3d ee = getPoint(GeoId,pos); + + if( (ee-cp).Length() < Precision::Confusion() ) { + secondPos = constr->FirstPos; + } + }; + PointPos secondPos1 = Sketcher::none, secondPos2 = Sketcher::none; ConstraintType constrType1 = Sketcher::PointOnObject, constrType2 = Sketcher::PointOnObject; @@ -2171,7 +2182,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) handleinternalalignment(constr, GeoId, secondPos1); } else { - secondPos1 = constr->FirstPos; + handlemultipleintersection(constr, GeoId, start, secondPos1); } } else if(secondPos2 == Sketcher::none && (constr->First == GeoId2 && constr->Second == GeoId)) { @@ -2181,7 +2192,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) handleinternalalignment(constr, GeoId, secondPos2); } else { - secondPos2 = constr->FirstPos; + handlemultipleintersection(constr, GeoId, end, secondPos2); } } }