From: vsv Date: Mon, 9 Oct 2017 13:01:19 +0000 (+0300) Subject: Improve tangent symbols positioning X-Git-Tag: V_2.9.0~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=14acd221c0a51b3e9e2593027fc43a205624e094;p=modules%2Fshaper.git Improve tangent symbols positioning --- diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp index 88b47ebc8..31921298b 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp @@ -354,8 +354,8 @@ std::list getCurves(const GeomPointPtr& thePnt, const SketcherPrs_Sym double aStart = aCurve->startParam(); double aEnd = aCurve->endParam(); GeomCirclePtr aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurve)); - double aParam; - if (aCircle->parameter(thePnt, 1.e-4, aParam) && (aParam >= aStart) && (aParam <= aEnd)) + GeomPointPtr aProjPnt = aCircle->project(thePnt); + if (thePnt->distance(aProjPnt) <= Precision::Confusion()) aList.push_back(aResObj); } } @@ -438,6 +438,8 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( aHasPlace = false; aPosCount = 0; } + if (aAngleStep <= 0) + break; } gp_Ax1 aRotAx(aP, aNormDir); diff --git a/src/SketcherPrs/SketcherPrs_Tangent.cpp b/src/SketcherPrs/SketcherPrs_Tangent.cpp index ae29e259d..70c96ac10 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.cpp +++ b/src/SketcherPrs/SketcherPrs_Tangent.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -77,29 +78,12 @@ bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep, bool withColor) GeomCurvePtr aCurv1 = std::shared_ptr(new GeomAPI_Curve(aShp1)); GeomCurvePtr aCurv2 = std::shared_ptr(new GeomAPI_Curve(aShp2)); - GeomCurvePtr aLine; - GeomCirclePtr aCircle; - double aFirst, aLast; - if (aCurv1->isLine()) { - aLine = aCurv1; - aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurv2)); - aFirst = aCurv2->startParam(); - aLast = aCurv2->endParam(); - } else { - aLine = aCurv2; - aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurv1)); - aFirst = aCurv1->startParam(); - aLast = aCurv1->endParam(); - } - - GeomPointPtr aPnt1 = aLine->getPoint(aLine->startParam()); - GeomPointPtr aPnt2 = aLine->getPoint(aLine->endParam()); - double aParam; GeomPointPtr aPnt; - if (aCircle->parameter(aPnt1, 1.e-4, aParam) && (aParam >= aFirst) && (aParam <= aLast)) - aPnt = aPnt1; - else if (aCircle->parameter(aPnt2, 1.e-4, aParam) && (aParam >= aFirst) && (aParam <= aLast)) - aPnt = aPnt2; + GeomShapePtr aIntPnt = aShp1->intersect(aShp2); + if (aIntPnt->isVertex()) { + GeomVertexPtr aVetrex(new GeomAPI_Vertex(aIntPnt)); + aPnt = aVetrex->point(); + } // Compute points coordinates if (aPnt.get()) {