From bfe7f30ee7a338756885e39acc66ef8d4360c42b Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Thu, 1 Jan 2015 19:53:25 +0300 Subject: [PATCH] Sketcher: AngleViaPoint: revert from OCC angle precalculation Returning back to the slow temporary-sketch-based calculateAngleViaPoint, because OCC-based version was incompatible with always-CCW sketcher geometry. More info in "Sketch: how to handle reversed external arcs?" forum thread http://forum.freecadweb.org/viewtopic.php?f=10&t=9130&sid=1b994fa1236db5ac2371eeb9a53de23f --- src/Mod/Sketcher/App/SketchObject.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 7747f094d1..e1fd1d4f5f 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -2302,6 +2302,20 @@ void SketchObject::validateConstraints() // lock down the type of tangency/perpendicularity. double SketchObject::calculateAngleViaPoint(int GeoId1, int GeoId2, double px, double py) { + // Temporary sketch based calculation. Slow, but guaranteed consistency with constraints. + Sketcher::Sketch sk; + int i1 = sk.addGeometry(this->getGeometry(GeoId1)); + int i2 = sk.addGeometry(this->getGeometry(GeoId2)); + + return sk.calculateAngleViaPoint(i1,i2,px,py); + + +/* + // OCC-based calculation. It is faster, but it was removed due to problems + // with reversed geometry (clockwise arcs). More info in "Sketch: how to + // handle reversed external arcs?" forum thread + // http://forum.freecadweb.org/viewtopic.php?f=10&t=9130&sid=1b994fa1236db5ac2371eeb9a53de23f + const Part::GeomCurve &g1 = *(dynamic_cast(this->getGeometry(GeoId1))); const Part::GeomCurve &g2 = *(dynamic_cast(this->getGeometry(GeoId2))); Base::Vector3d p(px, py, 0.0); @@ -2320,6 +2334,7 @@ double SketchObject::calculateAngleViaPoint(int GeoId1, int GeoId2, double px, d double ang = atan2(-tan2.X()*tan1.Y()+tan2.Y()*tan1.X(), tan2.X()*tan1.X() + tan2.Y()*tan1.Y()); return ang; +*/ } //Tests if the provided point lies exactly in a curve (satisfies