BezierKit icon indicating copy to clipboard operation
BezierKit copied to clipboard

`offset` fatalError when all control points of segments are the same

Open typoland opened this issue 4 years ago • 3 comments

As in tittle... sometimes happens, bcps are on points, points have same coordinates. Example project: on github

typoland avatar Jun 27 '21 17:06 typoland

Hello. Thanks for the example. It looks like this is a problem in BezierCurve.outline(distance:). I'll fix that.

As a workaround I'd suggest checking if all the points in the curve are equal and if so doing some special handling like using a circular path with the proper radius, for example.

hfutrell avatar Jun 28 '21 23:06 hfutrell

Hello! For now i just tested if points are the same and if so, moved one of them by 0.001. :)

Btw. I could not found some .cgPath() function to convert BezierCurve to CGPath. Is it exist?

typoland avatar Jun 29 '21 08:06 typoland

@typoland the BezierCurve type doesn't have a cgPath property but Path does, so you can do Path(curve: ...).cgPath instead.

hfutrell avatar Jun 29 '21 13:06 hfutrell