X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHUtils%2FSMESH_Offset.cxx;h=33d5b1c786200678be1ca53797c1ff1fec26a4f0;hp=564a09f69d598112ead34121ae574f0edfbfd9f7;hb=1dadb7d2e2350c62b25efa48135d55cd0b704c83;hpb=560f8b2d0c2a7fdb4047f981cfac56ed3629bc1a diff --git a/src/SMESHUtils/SMESH_Offset.cxx b/src/SMESHUtils/SMESH_Offset.cxx index 564a09f69..33d5b1c78 100644 --- a/src/SMESHUtils/SMESH_Offset.cxx +++ b/src/SMESHUtils/SMESH_Offset.cxx @@ -2656,6 +2656,11 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt, TEPairVec& theNew2OldFaces, TNPairVec& theNew2OldNodes) { + if ( theSrcMesh.GetMeshInfo().NbFaces( ORDER_QUADRATIC ) > 0 ) + throw SALOME_Exception( "Offset of quadratic mesh not supported" ); + if ( theSrcMesh.GetMeshInfo().NbFaces() > theSrcMesh.GetMeshInfo().NbTriangles() ) + throw SALOME_Exception( "Offset of non-triangular mesh not supported" ); + SMDS_Mesh* newMesh = new SMDS_Mesh; theNew2OldFaces.clear(); theNew2OldNodes.clear(); @@ -2663,11 +2668,6 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt, ( std::make_pair(( const SMDS_MeshElement*) 0, ( const SMDS_MeshElement*) 0)); // to have index == face->GetID() - if ( theSrcMesh.GetMeshInfo().NbFaces( ORDER_QUADRATIC ) > 0 ) - throw SALOME_Exception( "Offset of quadratic mesh not supported" ); - if ( theSrcMesh.GetMeshInfo().NbFaces() > theSrcMesh.GetMeshInfo().NbTriangles() ) - throw SALOME_Exception( "Offset of non-triangular mesh not supported" ); - // copy input faces to the newMesh keeping IDs of nodes double minNodeDist = 1e100; @@ -2747,8 +2747,9 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt, normals[i].SetCoord( 0,0,0 ); // TODO find norm by neighbors } - const double tol = 1e-3 * Sqrt( minNodeDist ); const double sign = ( theOffset < 0 ? -1 : +1 ); + const double tol = Min( 1e-3 * Sqrt( minNodeDist ), + 1e-2 * theOffset * sign ); // translate new nodes by normal to input faces gp_XYZ newXYZ;