double SMESH_Algo::EdgeLength(const TopoDS_Edge & E)
{
double UMin = 0, UMax = 0;
- if (BRep_Tool::Degenerated(E))
- return 0;
TopLoc_Location L;
Handle(Geom_Curve) C = BRep_Tool::Curve(E, L, UMin, UMax);
+ if ( C.IsNull() )
+ return 0.;
GeomAdaptor_Curve AdaptCurve(C, UMin, UMax); //range is important for periodic curves
double length = GCPnts_AbscissaPoint::Length(AdaptCurve, UMin, UMax);
return length;
return true;
}
+//================================================================================
+/*!
+ * \brief Return true if an edge has no 3D curve
+ */
+//================================================================================
+
+bool SMESH_Algo::isDegenerated( const TopoDS_Edge & E )
+{
+ double f,l;
+ TopLoc_Location loc;
+ Handle(Geom_Curve) C = BRep_Tool::Curve( E, loc, f,l );
+ return C.IsNull();
+}
+
//================================================================================
/*!
* \brief Return the node built on a vertex
* \brief Return true if an edge can be considered straight
*/
static bool isStraight( const TopoDS_Edge & E, const bool degenResult=false );
+ /*!
+ * \brief Return true if an edge has no 3D curve
+ */
+ static bool isDegenerated( const TopoDS_Edge & E );
/*!
* \brief Return the node built on a vertex
if( aS.ShapeType() == TopAbs_EDGE ) {
aTrackEdge = TopoDS::Edge( aS );
// the Edge must not be degenerated
- if ( BRep_Tool::Degenerated( aTrackEdge ) )
+ if ( SMESH_Algo::isDegenerated( aTrackEdge ) )
return EXTR_BAD_PATH_SHAPE;
TopExp::Vertices( aTrackEdge, aV1, aV2 );
aItN = theTrack->GetFather()->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
else if( aS.ShapeType() == TopAbs_EDGE ) {
aTrackEdge = TopoDS::Edge( aS );
// the Edge must not be degenerated
- if ( BRep_Tool::Degenerated( aTrackEdge ) )
+ if ( SMESH_Algo::isDegenerated( aTrackEdge ) )
return EXTR_BAD_PATH_SHAPE;
TopExp::Vertices( aTrackEdge, aV1, aV2 );
const SMDS_MeshNode* aN1 = SMESH_Algo::VertexNode( aV1, pMeshDS );
TopExp_Explorer eExp(aS, TopAbs_EDGE);
for(; eExp.More(); eExp.Next()) {
TopoDS_Edge E = TopoDS::Edge( eExp.Current() );
- if( BRep_Tool::Degenerated(E) ) continue;
+ if( SMESH_Algo::isDegenerated(E) ) continue;
SMESH_subMesh* SM = theTrack->GetSubMesh(E);
if(SM) {
LSM.push_back(SM);
}
// look for a degenerated edge
- if ( BRep_Tool::Degenerated( edge )) {
+ if ( SMESH_Algo::isDegenerated( edge )) {
myDegenShapeIds.insert( meshDS->ShapeToIndex( edge ));
for ( TopExp_Explorer v( edge, TopAbs_VERTEX ); v.More(); v.Next() )
myDegenShapeIds.insert( meshDS->ShapeToIndex( v.Current() ));
{
// check if the EDGE needs checking
const TopoDS_Edge& edge = TopoDS::Edge( edgeIt.Current() );
- if ( BRep_Tool::Degenerated( edge ) )
+ if ( SMESH_Algo::isDegenerated( edge ) )
continue;
if ( theHelper.IsRealSeam( edge ) &&
edge.Orientation() == TopAbs_REVERSED )
if ( _computeState != COMPUTE_OK )
{
if ( _subShape.ShapeType() == TopAbs_EDGE &&
- BRep_Tool::Degenerated( TopoDS::Edge( _subShape )) )
+ SMESH_Algo::isDegenerated( TopoDS::Edge( _subShape )) )
_computeState = COMPUTE_OK;
else if ( theComputeOK )
_computeError = SMESH_ComputeError::New(COMPERR_NO_MESH_ON_SHAPE,"",theAlgo);
if ( botSM ) {
if ( ! botSM->GetSubShape().IsSame( thePrism.myBottom )) {
std::swap( botSM, topSM );
- if ( ! botSM->GetSubShape().IsSame( thePrism.myBottom ))
+ if ( !botSM || ! botSM->GetSubShape().IsSame( thePrism.myBottom ))
return toSM( error( COMPERR_BAD_INPUT_MESH,
"Incompatible non-structured sub-meshes"));
}
list< TopoDS_Edge >::const_iterator edgeIt = prism.myBottomEdges.begin();
for ( int iE = 0; iE < prism.myNbEdgesInWires.front(); ++iE, ++edgeIt )
{
- if ( BRep_Tool::Degenerated( *edgeIt )) continue;
+ if ( SMESH_Algo::isDegenerated( *edgeIt )) continue;
const TParam2ColumnMap* u2colMap =
GetParam2ColumnMap( MeshDS()->ShapeToIndex( *edgeIt ), isReverse );
if ( !u2colMap ) return false;
sideEdges.splice(sideEdges.begin(), edges, --edges.end());
}
}
- if ( sideEdges.size() == 1 && BRep_Tool::Degenerated( sideEdges.front() ))
+ if ( sideEdges.size() == 1 && SMESH_Algo::isDegenerated( sideEdges.front() ))
degenSides.push_back( nbSides );
quad->side.push_back(new StdMeshers_FaceSide(F, sideEdges, &aMesh, nbSides < QUAD_TOP_SIDE,
for ( ; eExp.More(); eExp.Next() )
{
const TopoDS_Edge& E = TopoDS::Edge( eExp.Current() );
- if ( BRep_Tool::Degenerated( E )) continue;
+ if ( SMESH_Algo::isDegenerated( E )) continue;
// check if 2D curve is concave
BRepAdaptor_Curve2d curve( E, F );
const int nbIntervals = curve.NbIntervals( GeomAbs_C2 );