File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -461,12 +461,27 @@ extension BezierCurve {
461
461
}
462
462
alen = alen + slen
463
463
}
464
-
464
+
465
+ func cleanupCurves( _ curves: inout [ BezierCurve ] ) {
466
+ // ensures the curves are contiguous
467
+ for i in 0 ..< curves. count {
468
+ if i > 0 {
469
+ curves [ i] . startingPoint = curves [ i- 1 ] . endingPoint
470
+ }
471
+ if i < curves. count- 1 {
472
+ curves [ i] . endingPoint = 0.5 * ( curves [ i] . endingPoint + curves[ i+ 1 ] . startingPoint )
473
+ }
474
+ }
475
+ }
476
+
477
+ cleanupCurves ( & fcurves)
478
+ cleanupCurves ( & bcurves)
479
+
465
480
// reverse the "return" outline
466
481
bcurves = bcurves. map ( { ( s: BezierCurve ) in
467
482
return s. reversed ( )
468
483
} ) . reversed ( )
469
-
484
+
470
485
// form the endcaps as lines
471
486
let fs = fcurves [ 0 ] . points [ 0 ]
472
487
let fe = fcurves [ len- 1 ] . points [ fcurves [ len- 1 ] . points. count- 1 ]
You can’t perform that action at this time.
0 commit comments