From 14acd221c0a51b3e9e2593027fc43a205624e094 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 9 Oct 2017 16:01:19 +0300 Subject: [PATCH] Improve tangent symbols positioning --- src/SketcherPrs/SketcherPrs_PositionMgr.cpp | 6 +++-- src/SketcherPrs/SketcherPrs_Tangent.cpp | 28 +++++---------------- 2 files changed, 10 insertions(+), 24 deletions(-) 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()) { -- 2.39.2