From: eap Date: Mon, 17 Feb 2020 18:34:19 +0000 (+0300) Subject: Fix negative volume of valid but small polyhedron X-Git-Tag: V9_5_0a1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=48d9b5a07c9503326bb36321b3fa4cbc215c1e97;p=modules%2Fsmesh.git Fix negative volume of valid but small polyhedron https://salome-platform.org/forum/forum_10/547695356 --- diff --git a/src/SMDS/SMDS_VolumeTool.cxx b/src/SMDS/SMDS_VolumeTool.cxx index ba0798484..21accdc9d 100644 --- a/src/SMDS/SMDS_VolumeTool.cxx +++ b/src/SMDS/SMDS_VolumeTool.cxx @@ -706,11 +706,22 @@ double SMDS_VolumeTool::GetSize() const if ( !myPolyedre ) return 0.; + SaveFacet savedFacet( myCurFace ); + + // get an origin not lying in plane of any facet + int faceIndex = std::max( myCurFace.myIndex, 0 ); + setFace( faceIndex ); + double minProj, maxProj; + XYZ normal, origin; + projectNodesToNormal( faceIndex, minProj, maxProj, normal.data()); + GetFaceBaryCenter( faceIndex, origin.x, origin.y, origin.z ); + origin.x += normal.x * ( maxProj - minProj ) * 1e-1; + origin.y += normal.y * ( maxProj - minProj ) * 1e-2; + origin.z += normal.z * ( maxProj - minProj ) * 1e-3; + // split a polyhedron into tetrahedrons - SaveFacet savedFacet( myCurFace ); SMDS_VolumeTool* me = const_cast< SMDS_VolumeTool* > ( this ); - XYZ origin( 1 + 1e-6, 22 + 2e-6, 333 + 3e-6 ); // for invalid poly: avoid lying on a facet plane for ( int f = 0; f < NbFaces(); ++f ) { me->setFace( f ); diff --git a/src/SMESH_I/SMESH_PythonDump.cxx b/src/SMESH_I/SMESH_PythonDump.cxx index 7be8cb7ef..391b55527 100644 --- a/src/SMESH_I/SMESH_PythonDump.cxx +++ b/src/SMESH_I/SMESH_PythonDump.cxx @@ -696,7 +696,7 @@ namespace SMESH //function : DumpPython //purpose : //======================================================================= -Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Boolean isPublished, +Engines::TMPFile* SMESH_Gen_i::DumpPython( CORBA::Boolean isPublished, CORBA::Boolean isMultiFile, CORBA::Boolean& isValidScript) {