@@ -389,23 +389,23 @@ def get_parallels(bezier2, width):
389389 # find cm_left which is the intersecting point of a line through
390390 # c1_left with angle t1 and a line through c2_left with angle
391391 # t2. Same with cm_right.
392- if parallel_test != 0 :
393- # a special case for a straight line, i.e., angle between two
394- # lines are smaller than some (arbitrary) value.
395- cmx_left , cmy_left = (
396- 0.5 * (c1x_left + c2x_left ), 0.5 * (c1y_left + c2y_left )
397- )
398- cmx_right , cmy_right = (
399- 0.5 * (c1x_right + c2x_right ), 0.5 * (c1y_right + c2y_right )
400- )
401- else :
392+ try :
402393 cmx_left , cmy_left = get_intersection (c1x_left , c1y_left , cos_t1 ,
403394 sin_t1 , c2x_left , c2y_left ,
404395 cos_t2 , sin_t2 )
405-
406396 cmx_right , cmy_right = get_intersection (c1x_right , c1y_right , cos_t1 ,
407397 sin_t1 , c2x_right , c2y_right ,
408398 cos_t2 , sin_t2 )
399+ except ValueError :
400+ # Special case straight lines, i.e., angle between two lines is
401+ # less than the threshold used by get_intersection (we don't use
402+ # check_if_parallel as the threshold is not the same).
403+ cmx_left , cmy_left = (
404+ 0.5 * (c1x_left + c2x_left ), 0.5 * (c1y_left + c2y_left )
405+ )
406+ cmx_right , cmy_right = (
407+ 0.5 * (c1x_right + c2x_right ), 0.5 * (c1y_right + c2y_right )
408+ )
409409
410410 # the parallel Bezier lines are created with control points of
411411 # [c1_left, cm_left, c2_left] and [c1_right, cm_right, c2_right]
0 commit comments