]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Improve tangent symbols positioning
authorvsv <vsv@opencascade.com>
Mon, 9 Oct 2017 13:01:19 +0000 (16:01 +0300)
committervsv <vsv@opencascade.com>
Mon, 9 Oct 2017 13:01:46 +0000 (16:01 +0300)
src/SketcherPrs/SketcherPrs_PositionMgr.cpp
src/SketcherPrs/SketcherPrs_Tangent.cpp

index 88b47ebc8adc2baeece5c638c7775cfafd1c2ebc..31921298ba0424bf4a61a7eedc4fcded4f967873 100644 (file)
@@ -354,8 +354,8 @@ std::list<ObjectPtr> 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);
index ae29e259da80d4175cfdb3547031d242b6350048..70c96ac102f1c7965a87f81425df625e2316e7ac 100644 (file)
@@ -25,6 +25,7 @@
 #include <GeomAPI_Curve.h>
 #include <GeomAPI_Circ.h>
 #include <GeomAPI_Lin.h>
+#include <GeomAPI_Vertex.h>
 
 #include <SketchPlugin_Constraint.h>
 
@@ -77,29 +78,12 @@ bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep, bool withColor)
   GeomCurvePtr aCurv1 = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp1));
   GeomCurvePtr aCurv2 = std::shared_ptr<GeomAPI_Curve>(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()) {