X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHUtils%2FSMESH_Block.cxx;h=f0838270efc55477f09a0b75e28c7a4254fabbba;hb=3ecdf53dff60a9fd77128cfdb792dc18705f74a8;hp=b28dc7d67e2e666aac1ab76e6b059d443a544a8d;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6;p=modules%2Fsmesh.git diff --git a/src/SMESHUtils/SMESH_Block.cxx b/src/SMESHUtils/SMESH_Block.cxx index b28dc7d67..f0838270e 100644 --- a/src/SMESHUtils/SMESH_Block.cxx +++ b/src/SMESHUtils/SMESH_Block.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -694,12 +694,12 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint, start.SetCoord( iParam, sumParam / 4.); } if ( needGrid ) { - // compute nodes of 3 x 3 x 3 grid + // compute nodes of 10 x 10 x 10 grid int iNode = 0; Bnd_Box box; - for ( double x = 0.25; x < 0.9; x += 0.25 ) - for ( double y = 0.25; y < 0.9; y += 0.25 ) - for ( double z = 0.25; z < 0.9; z += 0.25 ) { + for ( double x = 0.05; x < 1.; x += 0.1 ) + for ( double y = 0.05; y < 1.; y += 0.1 ) + for ( double z = 0.05; z < 1.; z += 0.1 ) { TxyzPair & prmPtn = my3x3x3GridNodes[ iNode++ ]; prmPtn.first.SetCoord( x, y, z ); ShellPoint( prmPtn.first, prmPtn.second ); @@ -718,7 +718,7 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint, { double minDist = DBL_MAX; gp_XYZ* bestParam = 0; - for ( int iNode = 0; iNode < 27; iNode++ ) { + for ( int iNode = 0; iNode < 1000; iNode++ ) { TxyzPair & prmPtn = my3x3x3GridNodes[ iNode ]; double dist = ( thePoint.XYZ() - prmPtn.second ).SquareModulus(); if ( dist < minDist ) { @@ -819,6 +819,12 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint, << " ------ NB IT: " << myNbIterations << ", SUM DIST: " << mySumDist ); #endif + const double reachedDist = sqrt( sqDistance ); + if ( reachedDist > 1000 * myTolerance && + computeParameters( thePoint, theParams, solution ) && + reachedDist > distance() ) + return true; + theParams = solution; if ( myFaceIndex > 0 ) @@ -957,10 +963,10 @@ int SMESH_Block::GetShapeIDByParams ( const gp_XYZ& theCoord ) /*! * \brief Return number of wires and a list of oredered edges. * \param theFace - the face to process - * \param theFirstVertex - the vertex of the outer wire to set first in the returned - * list ( theFirstVertex may be NULL ) * \param theEdges - all ordered edges of theFace (outer edges goes first). * \param theNbEdgesInWires - nb of edges (== nb of vertices in closed wire) in each wire + * \param theFirstVertex - the vertex of the outer wire to set first in the returned + * list ( theFirstVertex may be NULL ) * \param theShapeAnalysisAlgo - if true, ShapeAnalysis::OuterWire() is used to find * the outer wire else BRepTools::OuterWire() is used. * \retval int - nb of wires @@ -972,9 +978,9 @@ int SMESH_Block::GetShapeIDByParams ( const gp_XYZ& theCoord ) //================================================================================ int SMESH_Block::GetOrderedEdges (const TopoDS_Face& theFace, - TopoDS_Vertex theFirstVertex, list< TopoDS_Edge >& theEdges, list< int > & theNbEdgesInWires, + TopoDS_Vertex theFirstVertex, const bool theShapeAnalysisAlgo) { // put wires in a list, so that an outer wire comes first @@ -1352,7 +1358,7 @@ bool SMESH_Block::FindBlockShapes(const TopoDS_Shell& theShell, // find bottom edges and veritices list< TopoDS_Edge > eList; list< int > nbVertexInWires; - GetOrderedEdges( TopoDS::Face( Fxy0 ), TopoDS::Vertex( V000 ), eList, nbVertexInWires ); + GetOrderedEdges( TopoDS::Face( Fxy0 ), eList, nbVertexInWires, TopoDS::Vertex( V000 ) ); if ( nbVertexInWires.size() != 1 || nbVertexInWires.front() != 4 ) { MESSAGE(" LoadBlockShapes() error "); return false; @@ -1374,7 +1380,7 @@ bool SMESH_Block::FindBlockShapes(const TopoDS_Shell& theShell, // find top edges and veritices eList.clear(); - GetOrderedEdges( TopoDS::Face( Fxy1 ), TopoDS::Vertex( V001 ), eList, nbVertexInWires ); + GetOrderedEdges( TopoDS::Face( Fxy1 ), eList, nbVertexInWires, TopoDS::Vertex( V001 ) ); if ( nbVertexInWires.size() != 1 || nbVertexInWires.front() != 4 ) { MESSAGE(" LoadBlockShapes() error "); return false;