X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FControls%2FSMESH_Controls.cxx;fp=src%2FControls%2FSMESH_Controls.cxx;h=3f612a24fc823cc2b4750d44f01095709f07ba70;hb=7d08ac8481b4a92dcad8fe4a3ea88956856dea15;hp=9978a6d6815728898853e7f2acb46a2800e43dab;hpb=aac6ba83a954d30516057206ead49bf3f0c23e93;p=modules%2Fsmesh.git diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx index 9978a6d68..3f612a24f 100644 --- a/src/Controls/SMESH_Controls.cxx +++ b/src/Controls/SMESH_Controls.cxx @@ -3013,12 +3013,13 @@ bool ConnectedElements::IsSatisfy( long theElementId ) namespace { - inline bool isLessAngle( const gp_Vec& v1, const gp_Vec& v2, const double cos2 ) + inline bool isLessAngle( const gp_Vec& v1, const gp_Vec& v2, const double cos ) { double dot = v1 * v2; // cos * |v1| * |v2| double l1 = v1.SquareMagnitude(); double l2 = v2.SquareMagnitude(); - return ( dot * dot ) / l1 / l2 >= cos2; + return (( dot * cos >= 0 ) && + ( dot * dot ) / l1 / l2 >= ( cos * cos )); } } CoplanarFaces::CoplanarFaces() @@ -3046,7 +3047,7 @@ void CoplanarFaces::SetMesh( const SMDS_Mesh* theMesh ) if (!normOK) return; - const double cosTol2 = Cos( myToler ) * Cos( myToler ); + const double cosTol = Cos( myToler * M_PI / 180. ); NCollection_Map< SMESH_TLink, SMESH_TLink > checkedLinks; std::list< pair< const SMDS_MeshElement*, gp_Vec > > faceQueue; @@ -3070,7 +3071,7 @@ void CoplanarFaces::SetMesh( const SMDS_Mesh* theMesh ) if ( f->GetNodeIndex( n2 ) > -1 ) { gp_Vec norm = getNormale( static_cast(f), &normOK ); - if (!normOK || isLessAngle( myNorm, norm, cosTol2)) + if (!normOK || isLessAngle( myNorm, norm, cosTol)) { myCoplanarIDs.Add( f->GetID() ); faceQueue.push_back( make_pair( f, norm ));