@@ -429,23 +429,23 @@ def get_parallels(bezier2, width):
429
429
# find cm_left which is the intersecting point of a line through
430
430
# c1_left with angle t1 and a line through c2_left with angle
431
431
# t2. Same with cm_right.
432
- if parallel_test != 0 :
433
- # a special case for a straight line, i.e., angle between two
434
- # lines are smaller than some (arbitrary) value.
435
- cmx_left , cmy_left = (
436
- 0.5 * (c1x_left + c2x_left ), 0.5 * (c1y_left + c2y_left )
437
- )
438
- cmx_right , cmy_right = (
439
- 0.5 * (c1x_right + c2x_right ), 0.5 * (c1y_right + c2y_right )
440
- )
441
- else :
432
+ try :
442
433
cmx_left , cmy_left = get_intersection (c1x_left , c1y_left , cos_t1 ,
443
434
sin_t1 , c2x_left , c2y_left ,
444
435
cos_t2 , sin_t2 )
445
-
446
436
cmx_right , cmy_right = get_intersection (c1x_right , c1y_right , cos_t1 ,
447
437
sin_t1 , c2x_right , c2y_right ,
448
438
cos_t2 , sin_t2 )
439
+ except ValueError :
440
+ # Special case straight lines, i.e., angle between two lines is
441
+ # less than the threshold used by get_intersection (we don't use
442
+ # check_if_parallel as the threshold is not the same).
443
+ cmx_left , cmy_left = (
444
+ 0.5 * (c1x_left + c2x_left ), 0.5 * (c1y_left + c2y_left )
445
+ )
446
+ cmx_right , cmy_right = (
447
+ 0.5 * (c1x_right + c2x_right ), 0.5 * (c1y_right + c2y_right )
448
+ )
449
449
450
450
# the parallel Bezier lines are created with control points of
451
451
# [c1_left, cm_left, c2_left] and [c1_right, cm_right, c2_right]
0 commit comments