From: jfa Date: Fri, 11 Nov 2022 10:45:09 +0000 (+0300) Subject: Correct tests for proximity depending on the order of shapes X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=49cea5f9c5ce736fc960d2a373bea439306cde08;p=modules%2Fgeom.git Correct tests for proximity depending on the order of shapes --- diff --git a/test/test_proximity_edge_edge.py b/test/test_proximity_edge_edge.py index 12f4b97a2..9c8e7329c 100644 --- a/test/test_proximity_edge_edge.py +++ b/test/test_proximity_edge_edge.py @@ -51,6 +51,16 @@ p_precise = p.preciseProximity() print( "coarse = {} ; fine = {}".format(p_coarse,p_precise) ) print( "Manually obtained value = {}".format( sqrt( (XY_red[0]-XY_blue[0])**2 + (XY_red[1]-XY_blue[1])**2 ) ) ) +assert(math.fabs(p_coarse - 223.00892775) < 1.e-7) + +prev = geompy.ShapeProximity() +prev.setShapes(blueEdge, redEdge) +prev.setSampling(redEdge, 1000) +prev.setSampling(blueEdge, 1000) +p_coarse = prev.coarseProximity() +p_precise = prev.preciseProximity() +print( "coarse = {} ; fine = {}".format(p_coarse,p_precise) ) + assert(math.fabs(p_coarse - 84.89994110) < 1.e-7) # Case 2: two bezier curves (different coarse and fine proximities) @@ -97,7 +107,7 @@ proximity2_coarse = p2.coarseProximity() proximity2_fine = p2.preciseProximity() assert(math.fabs(proximity1 - proximity2_fine) < 1.e-7) -assert(math.fabs(proximity2_coarse - 0.9974949866) < 1.e-7) +assert(math.fabs(proximity2_coarse - 0.99998769) < 1.e-7) assert(math.fabs(proximity2_fine - 1) < 1.e-7) # move second edge and check proximity diff --git a/test/test_proximity_face_face.py b/test/test_proximity_face_face.py index db3511ff2..a143709ba 100644 --- a/test/test_proximity_face_face.py +++ b/test/test_proximity_face_face.py @@ -25,7 +25,8 @@ Cut_1 = geompy.MakeCutList(Sph, [Translation_1], True, "Cut_1") Sph_face = geompy.SubShapeAllSortedCentres(Cut_1, geompy.ShapeType["FACE"], "Face")[1] pcalc = geompy.ShapeProximity() -pcalc.setShapes(Cyl_face, Sph_face) +#pcalc.setShapes(Cyl_face, Sph_face) +pcalc.setShapes(Sph_face, Cyl_face) p_coarse = pcalc.coarseProximity() p_fine = pcalc.preciseProximity()