From: mpv Date: Thu, 5 Apr 2018 13:48:29 +0000 (+0300) Subject: Fix for the issue #2458 : Tangent symbol is wrongly placed X-Git-Tag: V8_5_0rc2~8^2~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1f8fc2a2d77852365ea5fa5b4af6cc7d9541ed43;p=modules%2Fshaper.git Fix for the issue #2458 : Tangent symbol is wrongly placed --- diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp index edf7140a8..498926419 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp @@ -194,6 +194,20 @@ gp_Vec getVector(ObjectPtr theShape, GeomDirPtr theDir, gp_Pnt theP) double aParam = anExtr.LowerDistanceParameter(); gp_Pnt aP; aCurv->D1(aParam, aP, aVec); + // 2458: check correct orientation of the vector + if (aVec.SquareMagnitude() > Precision::Confusion()) { + std::shared_ptr aCircEdge(new GeomAPI_Edge(aShape)); + double aFirstParam, aLastParam; + aCircEdge->getRange(aFirstParam, aLastParam); + // if parameter is near the LastParam, make the vector go inside (reverse) + double aDelta = aLastParam - aParam; + while (aDelta < -Precision::Confusion()) + aDelta += 2. * M_PI; + while (aDelta > 2. * M_PI - Precision::Confusion()) + aDelta -= 2. * M_PI; + if (fabs(aDelta) < Precision::Confusion()) + aVec.Reverse(); + } } else { GeomPointPtr aPnt1 = aCurve->getPoint(aCurve->endParam()); GeomPointPtr aPnt2 = aCurve->getPoint(aCurve->startParam());