X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_MesherHelper.cxx;h=3b5483b13e49c1a72d5677277d0a49067b6a063d;hp=e5bedeedcfce3d8111cbb3182e64c0447eabf0b2;hb=HEAD;hpb=274fd4f2db8d3a7fa23701764280ea1d175b194b diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index e5bedeedc..49a115281 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -3279,6 +3279,16 @@ double SMESH_MesherHelper::getFaceMaxTol( const TopoDS_Shape& face ) const return tol; } +bool CheckAlmostZero(gp_Vec & vec1,gp_Vec & vec2, gp_Vec & vecref) +{ + auto v1 = gp_Dir(vec1); + auto v2 = gp_Dir(vec2); + auto vref = gp_Dir(vecref); + auto XYZ = v1.Crossed (v2); + double cond = XYZ.X()*vref.X()+XYZ.Y()*vref.Y()+XYZ.Z()*vref.Z(); + return (Abs(cond) <= 1e-12); +} + //================================================================================ /*! * \brief Return an angle between two EDGEs sharing a common VERTEX with reference @@ -3341,7 +3351,9 @@ double SMESH_MesherHelper::GetAngle( const TopoDS_Edge & theE1, if ( theE2.Orientation() /*GetSubShapeOri( F, theE2 )*/ == TopAbs_REVERSED ) vec2.Reverse(); angle = vec1.AngleWithRef( vec2, vecRef ); - + if ( angle < 0. && CheckAlmostZero(vec1,vec2,vecRef)) + angle*=-1; + if ( Abs ( angle ) >= 0.99 * M_PI ) { BRep_Tool::Range( theE1, f, l );