@@ -1387,7 +1387,7 @@ def _bez_get_tol_adapter(c, tol, rational=False, interval=None):
13871387 return nurbs_curve_param_tolerance (bern_to_nurbs_bezier (c , rational = rational , interval = interval ), tol )
13881388
13891389
1390- def bezier_intersect_certified_full (C1 : NDArray , C2 : NDArray , sv_thresh : float = 1e-8 , atol : float = 1e-3 , rational : bool = False ,** kwargs ) -> IntersectionResult :
1390+ def bez_ccx (C1 : NDArray , C2 : NDArray , sv_thresh : float = 1e-8 , atol : float = 1e-3 , rational : bool = False , ** kwargs ) -> IntersectionResult :
13911391 """Certified intersection for (possibly rational) Bézier curve pairs.
13921392
13931393 Parameters
@@ -1434,10 +1434,10 @@ def bezier_intersect_certified_full(C1: NDArray, C2: NDArray, sv_thresh: float
14341434 Planar polynomial case::
14351435
14361436 >>> import numpy as np
1437- >>> from mmcore.numeric.intersection.ccx._bez_ccx3 import bezier_intersect_certified_full
1437+ >>> from mmcore.numeric.intersection.ccx._bez_ccx3 import bez_ccx
14381438 >>> c1 = np.array([[0., 0., 0.], [1., 1., 0.], [2., 0., 0.]])
14391439 >>> c2 = np.array([[0., 0., 0.], [1., 0., 0.], [2., 0., 0.]])
1440- >>> res = bezier_intersect_certified_full (c1, c2)
1440+ >>> res = bez_ccx (c1, c2)
14411441 >>> len(res['isolated'])
14421442 2
14431443
@@ -1446,7 +1446,7 @@ def bezier_intersect_certified_full(C1: NDArray, C2: NDArray, sv_thresh: float
14461446 >>> w = np.sqrt(0.5)
14471447 >>> arc = np.array([[1., 0., 1.], [w, w, w], [0., 1., 1.]])
14481448 >>> line = np.array([[0., 0., 1.], [0.5, 0.5, 1.], [1., 1., 1.]])
1449- >>> res = bezier_intersect_certified_full (arc, line, rational=True)
1449+ >>> res = bez_ccx (arc, line, rational=True)
14501450 >>> np.allclose((res['isolated'][0]['u'], res['isolated'][0]['v']), (0.5, np.sqrt(0.5)))
14511451 True
14521452 """
@@ -1627,7 +1627,8 @@ def cell_contains_known_isolated(u0, u1, v0, v1, margin=1e-9):
16271627 min_d = float (np .min (dnet ))
16281628 if cell_contains_known_isolated (u0 , u1 , v0 , v1 ) :
16291629 res = {"type" : "none" }
1630- print ('bae' , (u0 , u1 ), (v0 , v1 ))
1630+ print ('bae' , (u0 , u1 ), (v0 , v1 ), )
1631+ continue
16311632 else :
16321633 res = contact_detect_and_extract (Pseg , Qseg , seed_uv = (0.5 , 0.5 ), sv_thresh = sv_thresh , rational = rational )
16331634
@@ -1886,7 +1887,7 @@ def get_interv(n) -> tuple[float, float]:
18861887
18871888 # case 1: One true overlap, no isolated points
18881889 s = time .perf_counter ()
1889- inter12 = bezier_intersect_certified_full (curve1 , curve2 )
1890+ inter12 = bez_ccx (curve1 , curve2 )
18901891 print (time .perf_counter () - s , "pruned:" , inter12 ["stats" ]["pruned" ]) # 0.07984466700008852 (current perf)
18911892 print ("\n \n case1\n " , "-" * 80 , "\n " )
18921893 assert len (inter12 ["isolated" ]) == 0
@@ -1924,7 +1925,7 @@ def get_interv(n) -> tuple[float, float]:
19241925 # case 2: Two isolated points, no overlaps
19251926 print ("\n \n case2\n " , "-" * 80 , "\n " )
19261927 s = time .perf_counter ()
1927- inter34 = bezier_intersect_certified_full (curve3 , curve4 )
1928+ inter34 = bez_ccx (curve3 , curve4 )
19281929 # 0.02212008300011803 (current perf)
19291930 print (time .perf_counter () - s , "pruned:" , inter34 ["stats" ]["pruned" ])
19301931 #print(inter34)
@@ -1947,7 +1948,7 @@ def get_interv(n) -> tuple[float, float]:
19471948 print ("\n \n case3.1\n " , "-" * 80 , "\n " )
19481949 # case 3.1: Two isolated points, but the curves are close to each other and are almost parallel, which makes this example similar to overlap.
19491950 s = time .perf_counter ()
1950- inter36 = bezier_intersect_certified_full (curve3 , curve6 )
1951+ inter36 = bez_ccx (curve3 , curve6 )
19511952 print (time .perf_counter () - s , "pruned:" , inter36 ["stats" ]["pruned" ]) # 1.4956505000000107 current perf
19521953 #print(inter36) # WRONG! Only one isolated point is returning.
19531954
@@ -1977,7 +1978,7 @@ def get_interv(n) -> tuple[float, float]:
19771978 print ("\n \n case3.2\n " , "-" * 80 , "\n " )
19781979 # case 3.2: Everything is the same, they just swapped the curves around.
19791980 s = time .perf_counter ()
1980- inter63 = bezier_intersect_certified_full (curve6 , curve3 )
1981+ inter63 = bez_ccx (curve6 , curve3 )
19811982 print (time .perf_counter () - s , "pruned:" , inter63 ["stats" ]["pruned" ])
19821983 #print(
19831984 # inter63,
@@ -2015,7 +2016,7 @@ def get_interv(n) -> tuple[float, float]:
20152016 curve8 = np .array ([[0 , 0 ,0. ], [1 , 1 ,0. ], [2 , 0 ,0. ]], float ) # quadratic arc
20162017
20172018 s = time .perf_counter ()
2018- inter78 = bezier_intersect_certified_full (curve7 , curve8 )
2019+ inter78 = bez_ccx (curve7 , curve8 )
20192020 print (time .perf_counter () - s , "pruned:" , inter78 ["stats" ]["pruned" ])
20202021 #print(
20212022 # inter78,
@@ -2044,7 +2045,7 @@ def get_interv(n) -> tuple[float, float]:
20442045 curve_line_h = np .array ([[0.0 , 0.0 , 1.0 ], [1.0 , 1.0 , 1.0 ]])
20452046
20462047 s = time .perf_counter ()
2047- inter_rational = bezier_intersect_certified_full (curve_arc_h , curve_line_h , rational = True )
2048+ inter_rational = bez_ccx (curve_arc_h , curve_line_h , rational = True )
20482049 print (time .perf_counter () - s , "pruned:" , inter_rational ["stats" ]["pruned" ])
20492050 assert len (inter_rational ["isolated" ]) == 1
20502051 assert np .allclose (inter_rational ["isolated" ][0 ]["point" ], [np .sqrt (0.5 ), np .sqrt (0.5 )], atol = 1e-9 )
@@ -2080,7 +2081,7 @@ def get_interv(n) -> tuple[float, float]:
20802081 [52.914001 , 42.130837 , 0. , 0.707 ],
20812082 [49.76 , 45.703 , 0. , 1. ]])
20822083 s = time .perf_counter ()
2083- inter_rational2 = bezier_intersect_certified_full (elliptical_arc_pts_h , arc_pts2_h , rational = True )
2084+ inter_rational2 = bez_ccx (elliptical_arc_pts_h , arc_pts2_h , rational = True )
20842085 print (time .perf_counter () - s , "pruned:" , inter_rational2 ["stats" ]["pruned" ])
20852086 assert len (inter_rational2 ["isolated" ]) == 2
20862087
@@ -2098,7 +2099,7 @@ def get_interv(n) -> tuple[float, float]:
20982099
20992100 c3d1 ,c3d2 = np .array ([[- 2.5 , - 5.0 , 0.826 ], [- 2.5 , - 3.333 , 0.826 ], [- 2.5 , - 1.667 , 0.001 ], [- 2.5 , 0.0 , - 0.102 ]]),np .array ([[- 5.0 , - 2.5 , 0.052 ], [- 3.333 , - 2.5 , 0.052 ], [- 1.667 , - 2.5 , 0.75 ], [0.0 , - 2.5 , 0.75 ]])
21002101 s = time .perf_counter ()
2101- inter_3d_1 = bezier_intersect_certified_full (c3d1 ,c3d2 , rational = False )
2102+ inter_3d_1 = bez_ccx (c3d1 , c3d2 , rational = False )
21022103 print (time .perf_counter () - s , "pruned:" , inter_3d_1 ["stats" ]["pruned" ])
21032104 print ("pruned_by:" , set (inter_3d_1 ["stats" ]["pruned_by" ]))
21042105 make_rich_table (inter_3d_1 , {"isolated" : [{'u' :0.499982 ,'v' :0.499986 ,'point' :[- 2.500035 , - 2.500044 , 0.400817 ]}], "overlaps" : [],'stats' :{}}, 'case 7 (3d)' ,oracle_name = 'Expected' )
@@ -2114,7 +2115,7 @@ def get_interv(n) -> tuple[float, float]:
21142115 [- 0.18421653 , 0.21499867 , 0. ],
21152116 [- 0.18858128 , 0.2141638 , 0. ]])
21162117 s = time .perf_counter ()
2117- inter910 = bezier_intersect_certified_full (crv9 , crv10 , rational = False )
2118+ inter910 = bez_ccx (crv9 , crv10 , rational = False )
21182119 print (time .perf_counter () - s , "pruned:" , inter910 ["stats" ]["pruned" ])
21192120
21202121 for i in inter910 ["isolated" ]:
@@ -2140,7 +2141,7 @@ def get_interv(n) -> tuple[float, float]:
21402141 crv12 = np .array ([[- 0.4507911 , 0.11900211 , 0. ],
21412142 [0.32897481 , 0.35801962 , 0. ],
21422143 [0.25497926 , 0.73647834 , 0. ]])
2143- inter1112 = bezier_intersect_certified_full (crv11 , crv12 , rational = False )
2144+ inter1112 = bez_ccx (crv11 , crv12 , rational = False )
21442145 print (time .perf_counter () - s , "pruned:" , inter1112 ["stats" ]["pruned" ])
21452146 for i in inter1112 ["isolated" ]:
21462147 print ('uv:' ,[float (i ['u' ]),float (i ['v' ])], 'point:' ,i ['point' ].tolist ())
0 commit comments