MFEK / math.rlib

A library which supplies mathematics and algorithms for manipulating beziers.
Apache License 2.0
7 stars 4 forks source link

Circle arcs not smooth when points very near one another #27

Closed ctrlcctrlv closed 2 years ago

ctrlcctrlv commented 2 years ago

cc @simoncozens @RosaWagner this is the correct issue for the discussion had at the tail end of the resolved #16.

ctrlcctrlv commented 2 years ago

I already have a theory. I think it's a bad merger. Note how the two kinks are being caused by two times colocated corner points:

image

But we should rightly expect that every point on the segment which links a cap or join should be a curve point with two non-colocated handles, and that the first and last points should only be one time colocated.

ctrlcctrlv commented 2 years ago

It's almost certainly a merger problem.

Everything looks fine on my end pre-merger.

image

image

How are you merging @simoncozens @rosawagner?

If you don't see this before the segmentwise merger—what do you see?

ctrlcctrlv commented 2 years ago

Okay. Here's what we're doing administratively.

This issue is getting closed because --segmentwise was a hack which I thought would be fine, but circular arcs are not perfectly representable as cubic Bezier curves.

So, any overlap merge would struggle with these two overlapping Bézier curves which are almost—yet not quite—equivalent.

Issue #16—not #17—is getting reopened because segmentwise is not an appropriate fix.

I will then try to fix once again the path builder method of creating stroke outlines.

Thanks for user patience.

davelab6 commented 2 years ago

Screenshot_20220421-201802

The control points angled down (red) seem bad to me. I'm expecting a smooth top (green). Maybe unreasonably, if the underlying strokes don't have co-positioned top points.

ctrlcctrlv commented 2 years ago

@davelab6 they aren't. they are part of different paths.

For clarity see this exploded version:

image

davelab6 commented 2 years ago

Ah good call. I see the "4th segment of the beach ball" now.

Screenshot_20220421-204510