From 641ff4e312ab3aff4e76fc37b9ae8ce7900cd92b Mon Sep 17 00:00:00 2001 From: cconopoima Date: Mon, 4 Mar 2024 19:35:29 +0000 Subject: [PATCH] Modifications for conformity with test base and non regressional tests. --- src/SMESH/SMESH_MesherHelper.cxx | 14 +++++++++++++- src/Tools/blocFissure/gmu/fissureCoude.py | 5 ++++- test/netgen_runner_2D.py | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index 1be97fb72..49a115281 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -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 ); diff --git a/src/Tools/blocFissure/gmu/fissureCoude.py b/src/Tools/blocFissure/gmu/fissureCoude.py index f8ce927f0..014ab56fe 100644 --- a/src/Tools/blocFissure/gmu/fissureCoude.py +++ b/src/Tools/blocFissure/gmu/fissureCoude.py @@ -106,7 +106,10 @@ class fissureCoude(fissureGenerique): # --- tube coude sain - geometrieSaine = geompy.MakePartition([tube_1, coude, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1) + #Refactor to perform the partition in two steps to avoid break from occt (reported bug#) + #geometrieSaine = geompy.MakePartition([tube_1, coude, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1) + geometrieSaine0 = geompy.MakePartition([tube_1, coude], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1) + geometrieSaine = geompy.MakePartition([geometrieSaine0, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1) geomPublish(initLog.debug, geometrieSaine, self.nomCas, self.numeroCas ) [P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True) diff --git a/test/netgen_runner_2D.py b/test/netgen_runner_2D.py index 36be1b717..255a4a61a 100644 --- a/test/netgen_runner_2D.py +++ b/test/netgen_runner_2D.py @@ -169,8 +169,8 @@ def test_netgen2dLenghtFromEdge(): print("Nb Segments:", nb_segments) print("Nb Points:", nb_points) - assert nb_triangles == 12 - assert nb_points == 8 + assert nb_triangles == 12*2 + assert nb_points == 14 assert nb_segments == 12 if __name__ == "__main__": -- 2.39.2