@@ -94,16 +94,15 @@ def split_de_casteljau(beta, t):
9494 return left_beta , right_beta
9595
9696
97- # FIXME spelling mistake in the name of the parameter ``tolerence``
98- def find_bezier_t_intersecting_with_closedpath (bezier_point_at_t ,
99- inside_closedpath ,
100- t0 = 0. , t1 = 1. , tolerence = 0.01 ):
97+ @cbook ._rename_parameter ("3.1" , "tolerence" , "tolerance" )
98+ def find_bezier_t_intersecting_with_closedpath (
99+ bezier_point_at_t , inside_closedpath , t0 = 0. , t1 = 1. , tolerance = 0.01 ):
101100 """ Find a parameter t0 and t1 of the given bezier path which
102101 bounds the intersecting points with a provided closed
103102 path(*inside_closedpath*). Search starts from *t0* and *t1* and it
104103 uses a simple bisecting algorithm therefore one of the end point
105104 must be inside the path while the orther doesn't. The search stop
106- when |t0-t1| gets smaller than the given tolerence .
105+ when |t0-t1| gets smaller than the given tolerance .
107106 value for
108107
109108 - bezier_point_at_t : a function which returns x, y coordinates at *t*
@@ -125,8 +124,8 @@ def find_bezier_t_intersecting_with_closedpath(bezier_point_at_t,
125124
126125 while True :
127126
128- # return if the distance is smaller than the tolerence
129- if np .hypot (start [0 ] - end [0 ], start [1 ] - end [1 ]) < tolerence :
127+ # return if the distance is smaller than the tolerance
128+ if np .hypot (start [0 ] - end [0 ], start [1 ] - end [1 ]) < tolerance :
130129 return t0 , t1
131130
132131 # calculate the middle point
@@ -177,9 +176,9 @@ def point_at_t(self, t):
177176 return _x , _y
178177
179178
180- def split_bezier_intersecting_with_closedpath ( bezier ,
181- inside_closedpath ,
182- tolerence = 0.01 ):
179+ @ cbook . _rename_parameter ( "3.1" , "tolerence" , "tolerance" )
180+ def split_bezier_intersecting_with_closedpath (
181+ bezier , inside_closedpath , tolerance = 0.01 ):
183182
184183 """
185184 bezier : control points of the bezier segment
@@ -190,17 +189,17 @@ def split_bezier_intersecting_with_closedpath(bezier,
190189 bz = BezierSegment (bezier )
191190 bezier_point_at_t = bz .point_at_t
192191
193- t0 , t1 = find_bezier_t_intersecting_with_closedpath (bezier_point_at_t ,
194- inside_closedpath ,
195- tolerence = tolerence )
192+ t0 , t1 = find_bezier_t_intersecting_with_closedpath (
193+ bezier_point_at_t , inside_closedpath , tolerance = tolerance )
196194
197195 _left , _right = split_de_casteljau (bezier , (t0 + t1 ) / 2. )
198196 return _left , _right
199197
200198
201- def find_r_to_boundary_of_closedpath (inside_closedpath , xy ,
202- cos_t , sin_t ,
203- rmin = 0. , rmax = 1. , tolerence = 0.01 ):
199+ @cbook .deprecated ("3.1" )
200+ @cbook ._rename_parameter ("3.1" , "tolerence" , "tolerance" )
201+ def find_r_to_boundary_of_closedpath (
202+ inside_closedpath , xy , cos_t , sin_t , rmin = 0. , rmax = 1. , tolerance = 0.01 ):
204203 """
205204 Find a radius r (centered at *xy*) between *rmin* and *rmax* at
206205 which it intersect with the path.
@@ -216,14 +215,14 @@ def find_r_to_boundary_of_closedpath(inside_closedpath, xy,
216215 def _f (r ):
217216 return cos_t * r + cx , sin_t * r + cy
218217
219- find_bezier_t_intersecting_with_closedpath (_f , inside_closedpath ,
220- t0 = rmin , t1 = rmax ,
221- tolerence = tolerence )
218+ find_bezier_t_intersecting_with_closedpath (
219+ _f , inside_closedpath , t0 = rmin , t1 = rmax , tolerance = tolerance )
222220
223221# matplotlib specific
224222
225223
226- def split_path_inout (path , inside , tolerence = 0.01 , reorder_inout = False ):
224+ @cbook ._rename_parameter ("3.1" , "tolerence" , "tolerance" )
225+ def split_path_inout (path , inside , tolerance = 0.01 , reorder_inout = False ):
227226 """ divide a path into two segment at the point where inside(x, y)
228227 becomes False.
229228 """
@@ -252,7 +251,7 @@ def split_path_inout(path, inside, tolerence=0.01, reorder_inout=False):
252251
253252 bp = bezier_path .reshape ((- 1 , 2 ))
254253 left , right = split_bezier_intersecting_with_closedpath (
255- bp , inside , tolerence )
254+ bp , inside , tolerance )
256255 if len (left ) == 2 :
257256 codes_left = [Path .LINETO ]
258257 codes_right = [Path .MOVETO , Path .LINETO ]
@@ -305,7 +304,8 @@ def get_cos_sin(x0, y0, x1, y1):
305304 return dx / d , dy / d
306305
307306
308- def check_if_parallel (dx1 , dy1 , dx2 , dy2 , tolerence = 1.e-5 ):
307+ @cbook ._rename_parameter ("3.1" , "tolerence" , "tolerance" )
308+ def check_if_parallel (dx1 , dy1 , dx2 , dy2 , tolerance = 1.e-5 ):
309309 """ returns
310310 * 1 if two lines are parralel in same direction
311311 * -1 if two lines are parralel in opposite direction
@@ -314,9 +314,9 @@ def check_if_parallel(dx1, dy1, dx2, dy2, tolerence=1.e-5):
314314 theta1 = np .arctan2 (dx1 , dy1 )
315315 theta2 = np .arctan2 (dx2 , dy2 )
316316 dtheta = np .abs (theta1 - theta2 )
317- if dtheta < tolerence :
317+ if dtheta < tolerance :
318318 return 1
319- elif np .abs (dtheta - np .pi ) < tolerence :
319+ elif np .abs (dtheta - np .pi ) < tolerance :
320320 return - 1
321321 else :
322322 return False
0 commit comments