]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Correct tests for proximity depending on the order of shapes jfa/29468
authorjfa <jfa@opencascade.com>
Fri, 11 Nov 2022 10:45:09 +0000 (13:45 +0300)
committerjfa <jfa@opencascade.com>
Fri, 11 Nov 2022 10:45:09 +0000 (13:45 +0300)
test/test_proximity_edge_edge.py
test/test_proximity_face_face.py

index 12f4b97a2d62f23ce5c9b8786a1be2960b7a3438..9c8e7329c0e7a4d9422a030029535488ab2310e7 100644 (file)
@@ -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
index db3511ff27ece0fe218850affa632075413be6c6..a143709ba3ba26c3b2a34d8855b00409f9987708 100644 (file)
@@ -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()