From 4d7a9435c1939cb4ed8be4c7ee189f4edfa04a4b Mon Sep 17 00:00:00 2001 From: logari81 Date: Thu, 17 Nov 2011 21:53:40 +0000 Subject: [PATCH] + use a trick to improve edge dragging of arcs and circles (until we find a more proper solution) git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5149 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Mod/Sketcher/App/Sketch.cpp | 8 ++++++-- src/Mod/Sketcher/App/freegcs/GCS.cpp | 8 ++++++++ src/Mod/Sketcher/App/freegcs/GCS.h | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Mod/Sketcher/App/Sketch.cpp b/src/Mod/Sketcher/App/Sketch.cpp index 16e73200f..2fef3af1e 100644 --- a/src/Mod/Sketcher/App/Sketch.cpp +++ b/src/Mod/Sketcher/App/Sketch.cpp @@ -1497,7 +1497,9 @@ int Sketch::initMove(int geoId, PointPos pos) p1.y = &MoveParameters[3]; *p1.x = *center.x; *p1.y = *center.y; - GCSsys.addConstraintP2PCoincident(p1,center,-1); + int i=GCSsys.addConstraintP2PCoincident(p1,center,-1); + GCSsys.rescaleConstraint(i-1, 0.01); + GCSsys.rescaleConstraint(i, 0.01); } } else if (Geoms[geoId].type == Arc) { GCS::Point ¢er = Points[Geoms[geoId].midPointId]; @@ -1531,7 +1533,9 @@ int Sketch::initMove(int geoId, PointPos pos) p1.y = &MoveParameters[3]; *p1.x = *center.x; *p1.y = *center.y; - GCSsys.addConstraintP2PCoincident(p1,center,-1); + int i=GCSsys.addConstraintP2PCoincident(p1,center,-1); + GCSsys.rescaleConstraint(i-1, 0.01); + GCSsys.rescaleConstraint(i, 0.01); } } InitParameters = MoveParameters; diff --git a/src/Mod/Sketcher/App/freegcs/GCS.cpp b/src/Mod/Sketcher/App/freegcs/GCS.cpp index fb8c78f2a..e20a03eca 100644 --- a/src/Mod/Sketcher/App/freegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/freegcs/GCS.cpp @@ -403,6 +403,14 @@ int System::addConstraintP2PSymmetric(Point &p1, Point &p2, Line &l, int tagId) return addConstraintMidpointOnLine(p1, p2, l.p1, l.p2, tagId); } +void System::rescaleConstraint(int id, double coeff) +{ + if (id >= clist.size() || id < 0) + return; + if (clist[id]) + clist[id]->rescale(coeff); +} + void System::initSolution(VEC_pD ¶ms) { diff --git a/src/Mod/Sketcher/App/freegcs/GCS.h b/src/Mod/Sketcher/App/freegcs/GCS.h index ce30a3013..9e809c6c2 100644 --- a/src/Mod/Sketcher/App/freegcs/GCS.h +++ b/src/Mod/Sketcher/App/freegcs/GCS.h @@ -74,7 +74,7 @@ namespace GCS System(); System(std::vector clist_); ~System(); - + void clear(); void clearByTag(int tagId); @@ -124,6 +124,7 @@ namespace GCS int addConstraintEqualRadius(Circle &c1, Arc &a2, int tagId=0); int addConstraintEqualRadius(Arc &a1, Arc &a2, int tagId=0); int addConstraintP2PSymmetric(Point &p1, Point &p2, Line &l, int tagId=0); + void rescaleConstraint(int id, double coeff); void initSolution(VEC_pD ¶ms);