0028346: Function ProjectOnSegments of ShapeAnalysis_Curve returns only single soluti...
authorifv <ifv@opencascade.com>
Thu, 2 Feb 2017 12:38:10 +0000 (15:38 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 1 Jun 2017 10:55:22 +0000 (13:55 +0300)
Subdivision of curve parametric interval based on deflection criteria is added for curve type OtherCurve in
Extrema_GExtPC.gxx. Algorithm of subdivision is implemented in Extrema_Curve(2d)Tool.cxx

New Draw command projpcurve for projection of point on CurveOnSurface is added in SWDRAW_ShapeAnalysis.cxx
projpcurve is modified to reflect "start parameter" in usage message and Draw help.

14 files changed:
dox/user_guides/draw_test_harness/draw_test_harness.md
src/Extrema/Extrema_Curve2dTool.cxx [new file with mode: 0644]
src/Extrema/Extrema_Curve2dTool.hxx
src/Extrema/Extrema_CurveTool.cxx
src/Extrema/Extrema_CurveTool.hxx
src/Extrema/Extrema_GExtPC.gxx
src/Extrema/FILES
src/GeomFill/GeomFill_SnglrFunc.cxx
src/SWDRAW/SWDRAW_ShapeAnalysis.cxx
tests/bugs/modalg_6/bug28346 [new file with mode: 0644]
tests/de/step_2/R2
tests/de/step_2/S1
tests/de/step_2/T1
tests/de/step_3/B9

index 68c44c0..5181fa5 100644 (file)
@@ -9845,7 +9845,31 @@ projcurve k_1 0 1 5
 ==Param = -0.20000000000000001  Gap = 5.0009999000199947 
 ~~~~~
 
 ==Param = -0.20000000000000001  Gap = 5.0009999000199947 
 ~~~~~
 
-@subsubsection occt_draw_9_1_14 projface
+@subsubsection occt_draw_9_1_14 projpcurve
+
+Syntax:      
+~~~~~
+projpcurve <edge> <face>  <Tol> <X> <Y> <Z> [<start_param>]
+~~~~~
+
+**projpcurve** returns the projection of a given point on a given curve on surface. The curve on surface is defined by giving the edge and face names. Edge must have curve 2D repesentation on the face. Optional parameter <i>\<start_param\></i> is any parameter of pcurve, which is used by algoritm as start point for searching projection of given point with help of local Extrema algorithm. If this parameter is not set, algorithm uses whole parametric interval of pcurve for searching projection.   
+
+**Example:** 
+~~~~~ 
+##Using global searching   
+projpcurve f_1 f 1.e-7 0.877 0 0.479
+==Point: 0.87762772831890712 0 0.47934285275342808
+==Param: 0.49990578239977856
+==Dist: 0.0007152557954264938
+~~~~~
+##Using starting parameter on edge
+projpcurve f_1 f 1.e-7 0.877 0 0.479 .6
+==Point: 0.87762772831890712 0 0.47934285275342808
+==Param: 0.49990578239977856
+==Dist: 0.0007152557954264938
+~~~~~
+
+@subsubsection occt_draw_9_1_15 projface
 
 Syntax:      
 ~~~~~
 
 Syntax:      
 ~~~~~
@@ -9861,7 +9885,7 @@ projface a_1 10.0 0.0
 ==   =   proj  X = -116  Y = -45  Z = 0 
 ~~~~~
 
 ==   =   proj  X = -116  Y = -45  Z = 0 
 ~~~~~
 
-@subsubsection occt_draw_9_1_15 scaleshape
+@subsubsection occt_draw_9_1_16 scaleshape
 
 Syntax:   
 ~~~~~
 
 Syntax:   
 ~~~~~
@@ -9875,7 +9899,7 @@ Returns a new shape, which is the result of scaling of a given shape with a coef
 scaleshape r a_1 0.8 
 ~~~~~
 
 scaleshape r a_1 0.8 
 ~~~~~
 
-@subsubsection occt_draw_9_1_16 settolerance
+@subsubsection occt_draw_9_1_17 settolerance
 
 Syntax:      
 ~~~~~
 
 Syntax:      
 ~~~~~
@@ -9890,7 +9914,7 @@ Sets new values of tolerance for a given shape. If the second parameter <i>mode<
 settolerance a 0.001 
 ~~~~~
 
 settolerance a 0.001 
 ~~~~~
 
-@subsubsection occt_draw_9_1_17 splitface
+@subsubsection occt_draw_9_1_18 splitface
 
 Syntax:      
 ~~~~~
 
 Syntax:      
 ~~~~~
@@ -9908,7 +9932,7 @@ splitface r f u 5
 ==> Status:  DONE1 
 ~~~~~
 
 ==> Status:  DONE1 
 ~~~~~
 
-@subsubsection occt_draw_9_1_18 statshape
+@subsubsection occt_draw_9_1_19 statshape
 
 Syntax:      
 ~~~~~
 
 Syntax:      
 ~~~~~
@@ -9934,7 +9958,7 @@ statshape a
 ==> 34     bspsur: BSplineSurface 
 ~~~~~
 
 ==> 34     bspsur: BSplineSurface 
 ~~~~~
 
-@subsubsection occt_draw_9_1_19 tolerance
+@subsubsection occt_draw_9_1_20 tolerance
 
 Syntax:
 ~~~~~
 
 Syntax:
 ~~~~~
diff --git a/src/Extrema/Extrema_Curve2dTool.cxx b/src/Extrema/Extrema_Curve2dTool.cxx
new file mode 100644 (file)
index 0000000..aae6482
--- /dev/null
@@ -0,0 +1,74 @@
+// Created on: 1995-07-18
+// Created by: Modelistation
+// Copyright (c) 1995-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Extrema_Curve2dTool.hxx>
+#include <Adaptor2d_Curve2d.hxx>
+#include <TColStd_HArray1OfReal.hxx>
+#include <Precision.hxx>
+#include <GCPnts_TangentialDeflection.hxx>
+
+//=======================================================================
+//function : DeflCurvIntervals
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HArray1OfReal) 
+  Extrema_Curve2dTool::DeflCurvIntervals(const Adaptor2d_Curve2d& C)
+{
+  const Standard_Real epsd = 1.e-3;
+  const Standard_Real maxdefl = 1.e3;
+  const Standard_Real mindefl = 1.e-3;
+  Handle(TColStd_HArray1OfReal) Intervals;
+  Standard_Integer nbpnts = 23, i;
+  Standard_Real L = 0.;
+  Standard_Real tf = C.FirstParameter(), tl = C.LastParameter();
+  gp_Pnt2d aP = C.Value(tf);
+  for (i = 2; i <= nbpnts; ++i)
+  {
+    Standard_Real t = (tf * (nbpnts - i) + (i - 1) * tl) / (nbpnts - 1);
+    gp_Pnt2d aP1 = C.Value(t);
+    L += aP.Distance(aP1);
+  }
+  //
+  Standard_Real dLdt = L / (tl - tf);
+  if (L <= Precision::Confusion() || dLdt < epsd || (tl - tf) > 10000.)
+  {
+    nbpnts = 2;
+    Intervals = new TColStd_HArray1OfReal(1, nbpnts);
+    Intervals->SetValue(1, tf);
+    Intervals->SetValue(nbpnts, tl);
+    return Intervals;
+  }
+  //
+  Standard_Real aDefl = Max(0.01 * L / (2. * M_PI), mindefl);
+  if (aDefl > maxdefl)
+  {
+    nbpnts = 2;
+    Intervals = new TColStd_HArray1OfReal(1, nbpnts);
+    Intervals->SetValue(1, tf);
+    Intervals->SetValue(nbpnts, tl);
+    return Intervals;
+  }
+  Standard_Real aMinLen = Max(.00001*L, Precision::Confusion());
+  Standard_Real aTol = Max(0.00001*(tl - tf), Precision::PConfusion());
+  GCPnts_TangentialDeflection aPntGen(C, M_PI / 6, aDefl, 2, aTol, aMinLen);
+  nbpnts = aPntGen.NbPoints();
+  Intervals = new TColStd_HArray1OfReal(1, nbpnts);
+  for (i = 1; i <= nbpnts; ++i)
+  {
+    Intervals->SetValue(i, aPntGen.Parameter(i));
+  }
+  return Intervals;
+}
index 8e89a95..b4497dc 100644 (file)
@@ -25,6 +25,7 @@
 #include <GeomAbs_Shape.hxx>
 #include <Standard_Integer.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <GeomAbs_Shape.hxx>
 #include <Standard_Integer.hxx>
 #include <TColStd_Array1OfReal.hxx>
+#include <TColStd_HArray1OfReal.hxx>
 #include <Standard_Boolean.hxx>
 #include <gp_Pnt2d.hxx>
 #include <gp_Vec2d.hxx>
 #include <Standard_Boolean.hxx>
 #include <gp_Pnt2d.hxx>
 #include <gp_Vec2d.hxx>
@@ -63,7 +64,12 @@ public:
   //! Stores in <T> the  parameters bounding the intervals
   //! of continuity <S>.
     static void Intervals (const Adaptor2d_Curve2d& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S);
   //! Stores in <T> the  parameters bounding the intervals
   //! of continuity <S>.
     static void Intervals (const Adaptor2d_Curve2d& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S);
-  
+
+  //! Returns the parameters bounding the intervals of subdivision of curve
+  //! according to Curvature deflection. Value of deflection is defined in method.
+  //!
+    Standard_EXPORT static Handle(TColStd_HArray1OfReal) DeflCurvIntervals(const Adaptor2d_Curve2d& C);
+
     static Standard_Boolean IsClosed (const Adaptor2d_Curve2d& C);
   
     static Standard_Boolean IsPeriodic (const Adaptor2d_Curve2d& C);
     static Standard_Boolean IsClosed (const Adaptor2d_Curve2d& C);
   
     static Standard_Boolean IsPeriodic (const Adaptor2d_Curve2d& C);
index 2e43311..995e311 100644 (file)
@@ -21,6 +21,7 @@
 #include <Geom_BSplineCurve.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Vec.hxx>
 #include <Geom_BSplineCurve.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Vec.hxx>
+#include <GCPnts_TangentialDeflection.hxx>
 
 //=======================================================================
 //function : IsPeriodic
 
 //=======================================================================
 //function : IsPeriodic
@@ -36,4 +37,57 @@ Standard_Boolean Extrema_CurveTool::IsPeriodic(const Adaptor3d_Curve& C)
     return C.IsPeriodic();
 }
 
     return C.IsPeriodic();
 }
 
-
+//=======================================================================
+//function : DeflCurvIntervals
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HArray1OfReal) 
+Extrema_CurveTool::DeflCurvIntervals(const Adaptor3d_Curve& C)
+{
+  const Standard_Real epsd = 1.e-3;
+  const Standard_Real maxdefl = 1.e3;
+  const Standard_Real mindefl = 1.e-3;
+  Handle(TColStd_HArray1OfReal) Intervals;
+  Standard_Integer nbpnts = 23, i;
+  Standard_Real L = 0.;
+  Standard_Real tf = C.FirstParameter(), tl = C.LastParameter();
+  gp_Pnt aP = C.Value(tf);
+  for (i = 2; i <= nbpnts; ++i)
+  {
+    Standard_Real t = (tf * (nbpnts - i) + (i - 1) * tl) / (nbpnts - 1);
+    gp_Pnt aP1 = C.Value(t);
+    L += aP.Distance(aP1);
+  }
+  //
+  Standard_Real dLdt = L / (tl - tf);
+  if (L <= Precision::Confusion() || dLdt < epsd || (tl - tf) > 10000.) // To avoid problemwith GCPnts
+  {
+    nbpnts = 2;
+    Intervals = new TColStd_HArray1OfReal(1, nbpnts);
+    Intervals->SetValue(1, tf);
+    Intervals->SetValue(nbpnts, tl);
+    return Intervals;
+  }
+  //
+  Standard_Real aDefl = Max(0.01 * L / (2. * M_PI), mindefl);
+  if (aDefl > maxdefl)
+  {
+    nbpnts = 2;
+    Intervals = new TColStd_HArray1OfReal(1, nbpnts);
+    Intervals->SetValue(1, tf);
+    Intervals->SetValue(nbpnts, tl);
+    return Intervals;
+  }
+  //
+  Standard_Real aMinLen = Max(.00001*L, Precision::Confusion());
+  Standard_Real aTol = Max(0.00001*(tl - tf), Precision::PConfusion());
+  //
+  GCPnts_TangentialDeflection aPntGen(C, M_PI / 6, aDefl, 2, aTol, aMinLen);
+  nbpnts = aPntGen.NbPoints();
+  Intervals = new TColStd_HArray1OfReal(1, nbpnts);
+  for (i = 1; i <= nbpnts; ++i)
+  {
+    Intervals->SetValue(i, aPntGen.Parameter(i));
+  }
+  return Intervals;
+}
index 8dd3077..163b155 100644 (file)
@@ -25,6 +25,7 @@
 #include <GeomAbs_Shape.hxx>
 #include <Standard_Integer.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <GeomAbs_Shape.hxx>
 #include <Standard_Integer.hxx>
 #include <TColStd_Array1OfReal.hxx>
+#include <TColStd_HArray1OfReal.hxx>
 #include <Standard_Boolean.hxx>
 #include <GeomAbs_CurveType.hxx>
 #include <gp_Pnt.hxx>
 #include <Standard_Boolean.hxx>
 #include <GeomAbs_CurveType.hxx>
 #include <gp_Pnt.hxx>
@@ -65,8 +66,13 @@ public:
   //! The array must provide  enough room to  accomodate
   //! for the parameters. i.e. T.Length() > NbIntervals()
     static void Intervals (Adaptor3d_Curve& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S);
   //! The array must provide  enough room to  accomodate
   //! for the parameters. i.e. T.Length() > NbIntervals()
     static void Intervals (Adaptor3d_Curve& C, TColStd_Array1OfReal& T, const GeomAbs_Shape S);
-  
-  Standard_EXPORT static Standard_Boolean IsPeriodic (const Adaptor3d_Curve& C);
+
+  //! Returns the parameters bounding the intervals of subdivision of curve
+  //! according to Curvature deflection. Value of deflection is defined in method.
+  //!
+    Standard_EXPORT static Handle(TColStd_HArray1OfReal) DeflCurvIntervals(const Adaptor3d_Curve& C);
+
+    Standard_EXPORT static Standard_Boolean IsPeriodic (const Adaptor3d_Curve& C);
   
     static Standard_Real Period (const Adaptor3d_Curve& C);
   
   
     static Standard_Real Period (const Adaptor3d_Curve& C);
   
index d6ed889..d69b046 100644 (file)
@@ -28,6 +28,7 @@
 #include <Precision.hxx>
 #include <ElCLib.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <Precision.hxx>
 #include <ElCLib.hxx>
 #include <TColStd_Array1OfReal.hxx>
+#include <TColStd_HArray1OfReal.hxx>
 #include <NCollection_Array1.hxx>
 
 
 #include <NCollection_Array1.hxx>
 
 
@@ -260,13 +261,32 @@ void Extrema_GExtPC::Perform(const ThePoint& P)
     }
   default:
     {
     }
   default:
     {
+      const Standard_Integer aMaxSample = 17;
       Standard_Boolean IntExtIsDone = Standard_False;
       Standard_Boolean IntIsNotValid;
       Standard_Boolean IntExtIsDone = Standard_False;
       Standard_Boolean IntIsNotValid;
+      Handle(TColStd_HArray1OfReal) theHInter;
       n = TheCurveTool::NbIntervals(aCurve, GeomAbs_C2);
       n = TheCurveTool::NbIntervals(aCurve, GeomAbs_C2);
-      TColStd_Array1OfReal theInter(1, n+1);
+      if (n > 1)
+      {
+        theHInter = new TColStd_HArray1OfReal(1, n + 1);
+        TheCurveTool::Intervals(aCurve, theHInter->ChangeArray1(), GeomAbs_C2);
+      }
+      else
+      {
+        theHInter = TheCurveTool::DeflCurvIntervals(aCurve);
+        n = theHInter->Length() - 1;
+      }
+      mysample = Max(mysample / n, aMaxSample);
+      Standard_Real maxint = 0.;
+      for (i = 1; i <= n; ++i)
+      {
+        Standard_Real dt = theHInter->Value(i + 1) - theHInter->Value(i);
+        if (maxint < dt)
+        {
+          maxint = dt;
+        }
+      }
       Standard_Boolean isPeriodic = TheCurveTool::IsPeriodic(aCurve);
       Standard_Boolean isPeriodic = TheCurveTool::IsPeriodic(aCurve);
-      TheCurveTool::Intervals(aCurve, theInter, GeomAbs_C2);
-      mysample = Max(mysample/n, 17);
       TheVector V1;
       ThePoint PP;
       Standard_Real s1 = 0.0 ;
       TheVector V1;
       ThePoint PP;
       Standard_Real s1 = 0.0 ;
@@ -274,8 +294,9 @@ void Extrema_GExtPC::Perform(const ThePoint& P)
       myExtPC.Initialize(aCurve);
       for (i = 1; i <= n; i++)
       {
       myExtPC.Initialize(aCurve);
       for (i = 1; i <= n; i++)
       {
-        myintuinf = theInter(i);
-        myintusup = theInter(i+1);
+        myintuinf = theHInter->Value(i);
+        myintusup = theHInter->Value(i+1);
+        mysample = Max(RealToInt(aMaxSample*(myintusup - myintuinf) / maxint), 3);
         
         Standard_Real anInfToCheck = myintuinf;
         Standard_Real aSupToCheck = myintusup;
         
         Standard_Real anInfToCheck = myintuinf;
         Standard_Real aSupToCheck = myintusup;
index 1156af9..34ec6a7 100644 (file)
@@ -9,6 +9,7 @@ Extrema_CCLocFOfLocECC.hxx
 Extrema_CCLocFOfLocECC2d.hxx
 Extrema_CCLocFOfLocECC2d_0.cxx
 Extrema_CCLocFOfLocECC_0.cxx
 Extrema_CCLocFOfLocECC2d.hxx
 Extrema_CCLocFOfLocECC2d_0.cxx
 Extrema_CCLocFOfLocECC_0.cxx
+Extrema_Curve2dTool.cxx
 Extrema_Curve2dTool.hxx
 Extrema_Curve2dTool.lxx
 Extrema_CurveLocator.gxx
 Extrema_Curve2dTool.hxx
 Extrema_Curve2dTool.lxx
 Extrema_CurveLocator.gxx
index a81cee6..07ecd32 100644 (file)
@@ -47,11 +47,17 @@ void GeomFill_SnglrFunc::SetRatio(const Standard_Real Ratio)
  Standard_Integer GeomFill_SnglrFunc::NbIntervals(const GeomAbs_Shape S) const
 {
   GeomAbs_Shape HCS=GeomAbs_C0;
  Standard_Integer GeomFill_SnglrFunc::NbIntervals(const GeomAbs_Shape S) const
 {
   GeomAbs_Shape HCS=GeomAbs_C0;
-  switch(S) {
-  case GeomAbs_C0: HCS = GeomAbs_C2; break;
-  case GeomAbs_C1: HCS = GeomAbs_C3; break;
-  case GeomAbs_C2: HCS = GeomAbs_CN; break;
-  default: throw Standard_DomainError();
+  if (S == GeomAbs_C0)
+  {
+    HCS = GeomAbs_C2;
+  }
+  else if (S == GeomAbs_C1)
+  {
+    HCS = GeomAbs_C3;
+  }
+  else if (S >= GeomAbs_C2)
+  {
+    HCS = GeomAbs_CN;
   }
   return myHCurve->NbIntervals(HCS);
 }
   }
   return myHCurve->NbIntervals(HCS);
 }
@@ -59,11 +65,17 @@ void GeomFill_SnglrFunc::SetRatio(const Standard_Real Ratio)
  void GeomFill_SnglrFunc::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S) const
 {
   GeomAbs_Shape HCS=GeomAbs_C0;
  void GeomFill_SnglrFunc::Intervals(TColStd_Array1OfReal& T,const GeomAbs_Shape S) const
 {
   GeomAbs_Shape HCS=GeomAbs_C0;
-  switch(S) {
-  case GeomAbs_C0: HCS = GeomAbs_C2; break;
-  case GeomAbs_C1: HCS = GeomAbs_C3; break;
-  case GeomAbs_C2: HCS = GeomAbs_CN; break;
-  default: throw Standard_DomainError();
+  if (S == GeomAbs_C0)
+  {
+    HCS = GeomAbs_C2;
+  }
+  else if (S == GeomAbs_C1)
+  {
+    HCS = GeomAbs_C3;
+  }
+  else if (S >= GeomAbs_C2)
+  {
+    HCS = GeomAbs_CN;
   }
   myHCurve->Intervals(T, HCS);
 }
   }
   myHCurve->Intervals(T, HCS);
 }
index 0a21b1a..53452db 100644 (file)
@@ -60,6 +60,9 @@
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Wire.hxx>
 #include <TopTools_HSequenceOfShape.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Wire.hxx>
 #include <TopTools_HSequenceOfShape.hxx>
+#include <Adaptor3d_CurveOnSurface.hxx>
+#include <BRepAdaptor_HCurve2d.hxx>
+#include <BRepAdaptor_HSurface.hxx>
 
 #include <stdio.h>
 static Standard_Integer tolerance
 
 #include <stdio.h>
 static Standard_Integer tolerance
@@ -227,6 +230,66 @@ static Standard_Integer projcurve
   di<<"Result : "<<X<<"  "<<Y<<"  "<<Z<<"\nParam = "<<param<<"  Gap = "<<dist<<"\n";
   return 0;
 }
   di<<"Result : "<<X<<"  "<<Y<<"  "<<Z<<"\nParam = "<<param<<"  Gap = "<<dist<<"\n";
   return 0;
 }
+static Standard_Integer projpcurve
+(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  //  admet une EDGE ou une CURVE
+  if (argc < 7)
+  {
+    di << "Give : projpcurve edge face tol X Y Z [start_param]\n";
+    return 1;
+  }
+
+  TopoDS_Edge aEdge = TopoDS::Edge(DBRep::Get(argv[1]));
+  if (aEdge.IsNull())
+  {
+    di << "SHAPE " << argv[1] << " is not an EDGE\n"; return 1 /* Error */;
+  }
+  TopoDS_Face aFace = TopoDS::Face(DBRep::Get(argv[2]));
+  if (aFace.IsNull())
+  {
+    di << "SHAPE " << argv[2] << " is not a FACE\n"; return 1 /* Error */;
+  }
+
+  Standard_Real aTol = Draw::Atof(argv[3]);
+
+
+  Standard_Real X = Draw::Atof(argv[4]);
+  Standard_Real Y = Draw::Atof(argv[5]);
+  Standard_Real Z = Draw::Atof(argv[6]);
+
+  gp_Pnt aP3D(X, Y, Z);
+
+  Standard_Boolean IsStartPoint = Standard_False;
+  Standard_Real startpar = 0.;
+  if (argc > 7)
+  {
+    startpar = Draw::Atof(argv[7]);
+    IsStartPoint = Standard_True;
+  }
+
+  Adaptor3d_CurveOnSurface aCOnS =
+    Adaptor3d_CurveOnSurface(new BRepAdaptor_HCurve2d(BRepAdaptor_Curve2d(aEdge, aFace)),
+    new BRepAdaptor_HSurface(BRepAdaptor_Surface(aFace, Standard_False)));
+
+  gp_Pnt aPnt;
+  Standard_Real aParam;
+  ShapeAnalysis_Curve aTool;
+  Standard_Real aDist = RealLast();
+  if (IsStartPoint)
+  {
+    aDist = aTool.NextProject(startpar, aCOnS, aP3D, aTol, aPnt, aParam);
+  }
+  else
+  {
+    aDist = aTool.Project(aCOnS, aP3D, aTol, aPnt, aParam, Standard_False);
+  }
+
+  di << "Point:" << "\n" << aPnt.X() << " " << aPnt.Y() << " " << aPnt.Z() << "\n";
+  di << "Param: " << aParam << "\n";
+  di << "Dist: " << aDist << "\n";
+  return 0;
+}
 
 static Standard_Integer anaface
   (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 
 static Standard_Integer anaface
   (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
@@ -996,7 +1059,9 @@ static Standard_Integer checkedge(Draw_Interpretor& di, Standard_Integer argc, c
   theCommands.Add ("projface","nom_face X Y [Z]", __FILE__,projface,g);
   theCommands.Add ("projcurve","nom_edge | curve3d | curve3d first last + X Y Z",
                   __FILE__,projcurve,g);
   theCommands.Add ("projface","nom_face X Y [Z]", __FILE__,projface,g);
   theCommands.Add ("projcurve","nom_edge | curve3d | curve3d first last + X Y Z",
                   __FILE__,projcurve,g);
-  theCommands.Add ("anaface","nomface",__FILE__,anaface,g);
+  theCommands.Add("projpcurve", "edge face tol x y z [start_param]",
+    __FILE__, projpcurve, g);
+  theCommands.Add("anaface", "nomface", __FILE__, anaface, g);
   theCommands.Add ("statshape","shape [particul] : stats/particularites",
                   __FILE__,XSHAPE_statshape,g);
   theCommands.Add ("comptol","shape [nbpoints]",__FILE__,XSHAPE_comptoledge,g);
   theCommands.Add ("statshape","shape [particul] : stats/particularites",
                   __FILE__,XSHAPE_statshape,g);
   theCommands.Add ("comptol","shape [nbpoints]",__FILE__,XSHAPE_comptoledge,g);
diff --git a/tests/bugs/modalg_6/bug28346 b/tests/bugs/modalg_6/bug28346
new file mode 100644 (file)
index 0000000..aa996d4
--- /dev/null
@@ -0,0 +1,16 @@
+puts "========"
+puts "OCC28346"
+puts "========"
+puts ""
+#################################################
+# Function ProjectOnSegments of ShapeAnalysis_Curve 
+# returns only single solution leading to projection 
+# result far from optimal
+#################################################
+
+restore [locate_data_file bug28346.brep] f
+explode f e
+
+regexp {Dist: ([-0-9.+eE]+)} [projpcurve f_4 f 0.5 169.29762271743246 -75.660813304433930 1040.0634215916459] full dd
+if { abs($dd - 0.1685) > 0.0001 } { puts "Error : Projection is incorrect" }
+
index cc18f15..dbf4b23 100644 (file)
@@ -7,8 +7,8 @@ set ref_data {
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
 TPSTAT      : Faulties = 0  ( 0 )  Warnings = 31  ( 28 )  Summary  = 31  ( 28 )
 CHECKSHAPE  : Wires    = 0  ( 0 )  Faces    = 0  ( 0 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
 TPSTAT      : Faulties = 0  ( 0 )  Warnings = 31  ( 28 )  Summary  = 31  ( 28 )
 CHECKSHAPE  : Wires    = 0  ( 0 )  Faces    = 0  ( 0 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
-NBSHAPES    : Solid    = 0  ( 0 )  Shell    = 1  ( 1 )  Face     = 357  ( 357 )   Summary  = 2004  ( 2003 )
-STATSHAPE   : Solid    = 0  ( 0 )  Shell    = 1  ( 1 )  Face     = 357  ( 357 )   FreeWire = 0  ( 0 )   FreeEdge  = 0 ( 0 )   SharedEdge = 840  ( 839 )
+NBSHAPES    : Solid    = 0  ( 0 )  Shell    = 1  ( 1 )  Face     = 357  ( 357 )   Summary  = 2005  ( 2003 )
+STATSHAPE   : Solid    = 0  ( 0 )  Shell    = 1  ( 1 )  Face     = 357  ( 357 )   FreeWire = 0  ( 0 )   FreeEdge  = 0 ( 0 )   SharedEdge = 841  ( 839 )
 TOLERANCE   : MaxTol   = 0.007356791914  ( 0.009485808595 )  AvgTol   =  0.0003528568313  (  0.001207996284 )
 LABELS      : N0Labels = 1  ( 1 )  N1Labels = 0  ( 0 )  N2Labels = 0  ( 0 )   TotalLabels = 1  ( 1 )   NameLabels = 1  ( 1 )   ColorLabels = 1  ( 1 )   LayerLabels = 0  ( 0 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
 TOLERANCE   : MaxTol   = 0.007356791914  ( 0.009485808595 )  AvgTol   =  0.0003528568313  (  0.001207996284 )
 LABELS      : N0Labels = 1  ( 1 )  N1Labels = 0  ( 0 )  N2Labels = 0  ( 0 )   TotalLabels = 1  ( 1 )   NameLabels = 1  ( 1 )   ColorLabels = 1  ( 1 )   LayerLabels = 0  ( 0 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
index 85394d9..f98542a 100755 (executable)
@@ -1,7 +1,8 @@
 # !!!! This file is generated automatically, do not edit manually! See end script
 puts "TODO CR23096 ALL: TPSTAT : Faulty" 
 # !!!! This file is generated automatically, do not edit manually! See end script
 puts "TODO CR23096 ALL: TPSTAT : Faulty" 
-puts "TODO CR23096 ALL: CHECKSHAPE : Faulty" 
-puts "TODO CR23096 ALL: STATSHAPE : Faulty" 
+##puts "TODO CR23096 ALL: CHECKSHAPE : Faulty" 
+##puts "TODO CR23096 ALL: STATSHAPE : Faulty" 
+puts "TODO CR23096 ALL: TOLERANCE : Faulty" 
 
 
 set filename trj12_ttmouse-pe-214.stp
 
 
 set filename trj12_ttmouse-pe-214.stp
@@ -10,9 +11,9 @@ set ref_data {
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
 TPSTAT      : Faulties = 0  ( 0 )  Warnings = 40  ( 18 )  Summary  = 40  ( 18 )
 CHECKSHAPE  : Wires    = 64  ( 48 )  Faces    = 64  ( 48 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
 TPSTAT      : Faulties = 0  ( 0 )  Warnings = 40  ( 18 )  Summary  = 40  ( 18 )
 CHECKSHAPE  : Wires    = 64  ( 48 )  Faces    = 64  ( 48 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
-NBSHAPES    : Solid    = 15  ( 16 )  Shell    = 17  ( 17 )  Face     = 367  ( 366 )   Summary  = 2507  ( 2495 )
-STATSHAPE   : Solid    = 71  ( 79 )  Shell    = 87  ( 87 )  Face     = 2740  ( 2732 )   FreeWire = 0  ( 0 )   FreeEdge  = 0 ( 0 )   SharedEdge = 1065  ( 1057 )
-TOLERANCE   : MaxTol   =    4.483126782  (    5.153790881 )  AvgTol   =   0.05989244484  (   0.06644999522 )
+NBSHAPES    : Solid    = 15  ( 16 )  Shell    = 17  ( 17 )  Face     = 366  ( 366 )   Summary  = 2504  ( 2495 )
+STATSHAPE   : Solid    = 71  ( 79 )  Shell    = 87  ( 87 )  Face     = 2732  ( 2732 )   FreeWire = 0  ( 0 )   FreeEdge  = 0 ( 0 )   SharedEdge = 1064  ( 1057 )
+TOLERANCE   : MaxTol   =    116.4921053  (    5.153533204 )  AvgTol   =    0.5624518437  (   0.06644717105 )
 LABELS      : N0Labels = 10  ( 10 )  N1Labels = 32  ( 32 )  N2Labels = 0  ( 0 )   TotalLabels = 42  ( 42 )   NameLabels = 22  ( 22 )   ColorLabels = 22  ( 22 )   LayerLabels = 0  ( 0 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
 NCOLORS     : NColors  = 6  ( 6 )
 LABELS      : N0Labels = 10  ( 10 )  N1Labels = 32  ( 32 )  N2Labels = 0  ( 0 )   TotalLabels = 42  ( 42 )   NameLabels = 22  ( 22 )   ColorLabels = 22  ( 22 )   LayerLabels = 0  ( 0 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
 NCOLORS     : NColors  = 6  ( 6 )
index 7cab7c8..3b32cdc 100644 (file)
@@ -7,8 +7,8 @@ set ref_data {
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
 TPSTAT      : Faulties = 0  ( 0 )  Warnings = 31  ( 28 )  Summary  = 31  ( 28 )
 CHECKSHAPE  : Wires    = 0  ( 0 )  Faces    = 0  ( 0 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
 DATA        : Faulties = 0  ( 0 )  Warnings = 0  ( 0 )  Summary  = 0  ( 0 )
 TPSTAT      : Faulties = 0  ( 0 )  Warnings = 31  ( 28 )  Summary  = 31  ( 28 )
 CHECKSHAPE  : Wires    = 0  ( 0 )  Faces    = 0  ( 0 )  Shells   = 0  ( 0 )   Solids   = 0 ( 0 )
-NBSHAPES    : Solid    = 1  ( 1 )  Shell    = 1  ( 1 )  Face     = 357  ( 357 )   Summary  = 2005  ( 2004 )
-STATSHAPE   : Solid    = 1  ( 1 )  Shell    = 1  ( 1 )  Face     = 357  ( 357 )   FreeWire = 0  ( 0 )   FreeEdge  = 0 ( 0 )   SharedEdge = 840  ( 839 )
+NBSHAPES    : Solid    = 1  ( 1 )  Shell    = 1  ( 1 )  Face     = 357  ( 357 )   Summary  = 2006  ( 2004 )
+STATSHAPE   : Solid    = 1  ( 1 )  Shell    = 1  ( 1 )  Face     = 357  ( 357 )   FreeWire = 0  ( 0 )   FreeEdge  = 0 ( 0 )   SharedEdge = 841  ( 839 )
 TOLERANCE   : MaxTol   = 0.007356791914  ( 0.009485808595 )  AvgTol   =  0.0003528126958  (  0.001207999522 )
 LABELS      : N0Labels = 1  ( 1 )  N1Labels = 0  ( 0 )  N2Labels = 0  ( 0 )   TotalLabels = 1  ( 1 )   NameLabels = 1  ( 1 )   ColorLabels = 0  ( 0 )   LayerLabels = 0  ( 0 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
 TOLERANCE   : MaxTol   = 0.007356791914  ( 0.009485808595 )  AvgTol   =  0.0003528126958  (  0.001207999522 )
 LABELS      : N0Labels = 1  ( 1 )  N1Labels = 0  ( 0 )  N2Labels = 0  ( 0 )   TotalLabels = 1  ( 1 )   NameLabels = 1  ( 1 )   ColorLabels = 0  ( 0 )   LayerLabels = 0  ( 0 )
 PROPS       : Centroid = 0  ( 0 )  Volume   = 0  ( 0 )  Area     = 0  ( 0 )
index b6c65f0..c6d329c 100644 (file)
@@ -1,6 +1,7 @@
 # !!!! This file is generated automatically, do not edit manually! See end script
 puts "TODO CR23096 ALL: STATSHAPE : Faulty" 
 # !!!! This file is generated automatically, do not edit manually! See end script
 puts "TODO CR23096 ALL: STATSHAPE : Faulty" 
-puts "TODO CR25013 ALL: Error : 1 differences with reference data found" 
+puts "TODO CR23096 ALL: TOLERANCE : Faulty" 
+puts "TODO CR25013 ALL: Error : 3 differences with reference data found" 
 
 set LinuxDiff 2
 set filename wgehaeuse_surface.stp
 
 set LinuxDiff 2
 set filename wgehaeuse_surface.stp