Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Nouveau message d'erreur pour le tube
[modules/smesh.git]
/
src
/
SMESHUtils
/
SMESH_Triangulate.cxx
diff --git
a/src/SMESHUtils/SMESH_Triangulate.cxx
b/src/SMESHUtils/SMESH_Triangulate.cxx
index 0d0aaca1f457c310338f0ce89d74155f05d832fc..149ce45b77eaab7504c4b4e7fef6d6443b0c6847 100644
(file)
--- a/
src/SMESHUtils/SMESH_Triangulate.cxx
+++ b/
src/SMESHUtils/SMESH_Triangulate.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-20
19
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-20
20
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
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-81,10
+81,10
@@
struct Triangulate::PolyVertex
PolyVertex* Delete();
// compare PolyVertex'es by node
PolyVertex* Delete();
// compare PolyVertex'es by node
- bool operator()(const PolyVertex* a, const PolyVertex* b) const
-
{
-
return ( a->_nxyz.Node() < b->_nxyz.Node() );
-
}
+ bool operator()(const PolyVertex* a, const PolyVertex* b) const
+ {
+ return ( a->_nxyz.Node() < b->_nxyz.Node() );
+ }
// set of PolyVertex sorted by mesh node
typedef boost::container::flat_set< PolyVertex*, PolyVertex > PVSet;
};
// set of PolyVertex sorted by mesh node
typedef boost::container::flat_set< PolyVertex*, PolyVertex > PVSet;
};
@@
-350,7
+350,7
@@
bool Triangulate::triangulate( std::vector< const SMDS_MeshNode*>& nodes,
// connect nodes into a ring
_pv.resize( nbNodes );
for ( size_t i = 1; i < nbNodes; ++i )
// connect nodes into a ring
_pv.resize( nbNodes );
for ( size_t i = 1; i < nbNodes; ++i )
- _pv[i-1].SetNodeAndNext( nodes[i-1], _pv[i], i-1 );
+ _pv[i-1].SetNodeAndNext( nodes[i-1], _pv[i],
/*index=*/
i-1 );
_pv[ nbNodes-1 ].SetNodeAndNext( nodes[ nbNodes-1 ], _pv[0], nbNodes-1 );
// assure correctness of PolyVertex::_index as a node can encounter more than once
_pv[ nbNodes-1 ].SetNodeAndNext( nodes[ nbNodes-1 ], _pv[0], nbNodes-1 );
// assure correctness of PolyVertex::_index as a node can encounter more than once
@@
-380,20
+380,26
@@
bool Triangulate::triangulate( std::vector< const SMDS_MeshNode*>& nodes,
try {
axes = gp_Ax2( p0, normal, v01 );
}
try {
axes = gp_Ax2( p0, normal, v01 );
}
- catch ( Standard_Failure ) {
+ catch ( Standard_Failure
&
) {
return false;
}
return false;
}
+ double factor = 1.0, modulus = normal.Modulus();
+ if ( modulus < 1e-2 )
+ factor = 1. / sqrt( modulus );
for ( size_t i = 0; i < nbNodes; ++i )
{
gp_XYZ p = _pv[i]._nxyz - p0;
for ( size_t i = 0; i < nbNodes; ++i )
{
gp_XYZ p = _pv[i]._nxyz - p0;
- _pv[i]._xy.SetX( axes.XDirection().XYZ() * p );
- _pv[i]._xy.SetY( axes.YDirection().XYZ() * p );
+ _pv[i]._xy.SetX( axes.XDirection().XYZ() * p
* factor
);
+ _pv[i]._xy.SetY( axes.YDirection().XYZ() * p
* factor
);
}
// compute minimal triangle area
double sumArea = 0;
}
// compute minimal triangle area
double sumArea = 0;
- for ( size_t i = 0; i < nbNodes; ++i )
- sumArea += _pv[i].TriaArea();
+ if ( factor == 1.0 )
+ sumArea = modulus;
+ else
+ for ( size_t i = 0; i < nbNodes; ++i )
+ sumArea += _pv[i].TriaArea();
const double minArea = 1e-6 * sumArea / ( nbNodes - 2 );
// in a loop, find triangles with positive area and having no vertices inside
const double minArea = 1e-6 * sumArea / ( nbNodes - 2 );
// in a loop, find triangles with positive area and having no vertices inside