mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-03 12:30:33 +05:00
Fix negative volume of valid but small polyhedron
https://salome-platform.org/forum/forum_10/547695356
This commit is contained in:
parent
0fe03353fe
commit
48d9b5a07c
@ -706,11 +706,22 @@ double SMDS_VolumeTool::GetSize() const
|
|||||||
if ( !myPolyedre )
|
if ( !myPolyedre )
|
||||||
return 0.;
|
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
|
// split a polyhedron into tetrahedrons
|
||||||
|
|
||||||
SaveFacet savedFacet( myCurFace );
|
|
||||||
SMDS_VolumeTool* me = const_cast< SMDS_VolumeTool* > ( this );
|
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 )
|
for ( int f = 0; f < NbFaces(); ++f )
|
||||||
{
|
{
|
||||||
me->setFace( f );
|
me->setFace( f );
|
||||||
|
@ -696,7 +696,7 @@ namespace SMESH
|
|||||||
//function : DumpPython
|
//function : DumpPython
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Boolean isPublished,
|
Engines::TMPFile* SMESH_Gen_i::DumpPython( CORBA::Boolean isPublished,
|
||||||
CORBA::Boolean isMultiFile,
|
CORBA::Boolean isMultiFile,
|
||||||
CORBA::Boolean& isValidScript)
|
CORBA::Boolean& isValidScript)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user