]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022353: EDF GEOM: Projection on a edge or a wire
authorskv <skv@opencascade.com>
Wed, 13 Nov 2013 06:26:37 +0000 (06:26 +0000)
committerskv <skv@opencascade.com>
Wed, 13 Nov 2013 06:26:37 +0000 (06:26 +0000)
src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx

index ebc0843ed3a524f3f44d427f0e8b9a2a2f713865..e8fa499b5e952046cc1a76d9e8f7cd47d2bd7f6b 100644 (file)
@@ -344,14 +344,36 @@ Standard_Integer GEOMImpl_ProjectionDriver::Execute(TFunction_Logbook& log) cons
 
         // Store the valid solution.
         hasValidSolution = Standard_True;
+
+        // Normalize parameter.
+        TopoDS_Edge aSupportEdge = TopoDS::Edge(aSupportShape);
+        Standard_Real aF, aL;
+
+        BRep_Tool::Range(aSupportEdge, aF, aL);
+
+        if (Abs(aL - aF) <= aTolConf) {
+          Standard_ConstructionError::Raise
+            ("Projection aborted : degenerated projection edge");
+        }
+
+        aParam = (aParam - aF)/(aL - aF);
         aProj.SetU(aParam);
 
         // Compute edge index.
-        TopTools_IndexedMapOfShape anIndices;
-        TopExp::MapShapes(aShape, anIndices);
-        const int anIndex = anIndices.FindIndex(aSupportShape);
+        TopExp_Explorer anExp(aShape, TopAbs_EDGE);
+        int anIndex = 0;
+
+        for (; anExp.More(); anExp.Next(), anIndex++) {
+          if (aSupportShape.IsSame(anExp.Current())) {
+            aProj.SetIndex(anIndex);
+            break;
+          }
+        }
 
-        aProj.SetIndex(anIndex);
+        if (!anExp.More()) {
+          Standard_ConstructionError::Raise
+            ("Projection aborted : Can't define edge index");
+        }
 
         // Construct a projection vertex.
         const gp_Pnt &aPntProj = aDistShSh.PointOnShape2(i);