Salome HOME
report error when a major radius is less that a minor one
[modules/geom.git] / src / GEOMImpl / GEOMImpl_IMeasureOperations.cxx
index c62f4ac26d172c6401bc690ed89bd25844db4d56..d6a25978770b96e513df9684d7976cc23205936b 100644 (file)
@@ -1479,7 +1479,8 @@ static double CheckSingularCase(const TopoDS_Shape& aSh1,
       if( sh.ShapeType()==TopAbs_SHELL || sh.ShapeType()==TopAbs_FACE ) {
         // non solid case
         double U1,U2,V1,V2;
-        S->Bounds(U1,U2,V1,V2);
+        //S->Bounds(U1,U2,V1,V2);
+        ShapeAnalysis::GetFaceUVBounds(TopoDS::Face(tmpSh2),U1,U2,V1,V2);
         Handle(Geom_RectangularTrimmedSurface) TrS1 = 
           new Geom_RectangularTrimmedSurface(S,U1,(U1+U2)/2.,V1,V2);
         Handle(Geom_RectangularTrimmedSurface) TrS2 = 
@@ -1679,6 +1680,37 @@ static bool CheckSingularCase(const TopoDS_Shape& aSh1,
 */
 
 
+//=============================================================================
+/*!
+ *  AreCoordsInside
+ */
+//=============================================================================
+std::vector<bool> GEOMImpl_IMeasureOperations::AreCoordsInside(Handle(GEOM_Object) theShape,
+                                                              const std::vector<double>& coords,
+                                                              double tolerance)
+{
+  std::vector<bool> res;
+  if (!theShape.IsNull()) {
+    Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+    if (!aRefShape.IsNull()) {
+      TopoDS_Shape aShape = aRefShape->GetValue();
+      if (!aShape.IsNull()) {
+       BRepClass3d_SolidClassifier SC(aShape);
+       unsigned int nb_points = coords.size()/3;
+       for (int i = 0; i < nb_points; i++) {
+         double x = coords[3*i];
+         double y = coords[3*i+1];
+         double z = coords[3*i+2];
+         gp_Pnt aPnt(x, y, z);
+         SC.Perform(aPnt, tolerance);
+         res.push_back( ( SC.State() == TopAbs_IN ) || ( SC.State() == TopAbs_ON ) );
+       }
+      }
+    }
+  }
+  return res;
+}
+
 //=============================================================================
 /*!
  *  GetMinDistance
@@ -1979,10 +2011,10 @@ Standard_Real GEOMImpl_IMeasureOperations::CurveCurvatureByPoint
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
     OCC_CATCH_SIGNALS;
 #endif
-    GeomAPI_ProjectPointOnCurve PPC(aPoint, aCurve, aFP, aLP);
-    if(PPC.NbPoints()>0) {
+    GeomAPI_ProjectPointOnCurve PPCurve(aPoint, aCurve, aFP, aLP);
+    if(PPCurve.NbPoints()>0) {
       GeomLProp_CLProps Prop = GeomLProp_CLProps 
-        (aCurve, PPC.LowerDistanceParameter(), 2, Precision::Confusion());
+        (aCurve, PPCurve.LowerDistanceParameter(), 2, Precision::Confusion());
       aRes = fabs(Prop.Curvature());
       SetErrorCode(OK);
     }