From: mpa Date: Thu, 4 Apr 2013 11:59:37 +0000 (+0000) Subject: 0022186: [CEA 803] AreCoordsInside gives a wrong result X-Git-Tag: V6_main_FINAL~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f5522d8c47a39e79515a0cad76781ed15a99b137;p=modules%2Fgeom.git 0022186: [CEA 803] AreCoordsInside gives a wrong result --- diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index 78825e1f1..55dff9bff 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -1558,15 +1558,25 @@ std::vector GEOMImpl_IMeasureOperations::AreCoordsInside(Handle(GEOM_Objec 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 ) ); + if ( aShape.ShapeType() == TopAbs_COMPOUND || aShape.ShapeType() == TopAbs_COMPSOLID || + aShape.ShapeType() == TopAbs_SOLID ) { + TopExp_Explorer anExp; + bool isFound = false; + for ( anExp.Init( aShape, TopAbs_SOLID ); anExp.More() && !isFound; anExp.Next() ) { + BRepClass3d_SolidClassifier SC( anExp.Current() ); + SC.Perform( aPnt, tolerance ); + isFound = ( SC.State() == TopAbs_IN ) || ( SC.State() == TopAbs_ON ); + } + res.push_back( isFound ); + } + else + res.push_back( false ); } } } diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 01e17c1eb..a66b50b65 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -8952,7 +8952,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): return aTuple ## Get if coords are included in the shape (ST_IN or ST_ON) - # @param theShape Shape + # @param theShape Shape (only Compound, Compsolid or Solid) # @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...] # @param tolerance to be used (default is 1.0e-7) # @return list_of_boolean = [res1, res2, ...] @@ -8961,7 +8961,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): Get if coords are included in the shape (ST_IN or ST_ON) Parameters: - theShape Shape + theShape Shape (only Compound, Compsolid or Solid) coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...] tolerance to be used (default is 1.0e-7)