File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Original file line number Diff line number Diff line change @@ -171,9 +171,17 @@ def find_bezier_t_intersecting_with_closedpath(
171
171
172
172
if start_inside ^ middle_inside :
173
173
t1 = middle_t
174
+ if end == middle :
175
+ # Edge case where infinite loop is possible
176
+ # Caused by large numbers relative to tolerance
177
+ return t0 , t1
174
178
end = middle
175
179
else :
176
180
t0 = middle_t
181
+ if start == middle :
182
+ # Edge case where infinite loop is possible
183
+ # Caused by large numbers relative to tolerance
184
+ return t0 , t1
177
185
start = middle
178
186
start_inside = middle_inside
179
187
Original file line number Diff line number Diff line change
1
+ """
2
+ Tests specific to the bezier module.
3
+ """
4
+
5
+ from matplotlib .bezier import inside_circle , split_bezier_intersecting_with_closedpath
6
+
7
+
8
+ def test_split_bezier_with_large_values ():
9
+ # These numbers come from gh-27753
10
+ arrow_path = [(96950809781500.0 , 804.7503795623779 ),
11
+ (96950809781500.0 , 859.6242585800646 ),
12
+ (96950809781500.0 , 914.4981375977513 )]
13
+ in_f = inside_circle (96950809781500.0 , 804.7503795623779 , 0.06 )
14
+ split_bezier_intersecting_with_closedpath (arrow_path , in_f )
15
+ # All we are testing is that this completes
16
+ # The failure case is an infinite loop resulting from floating point precision
17
+ # pytest will timeout if that occurs
You can’t perform that action at this time.
0 commit comments