I want to draw the outline of a circle (it's actually the glyph period
from Cascadia Code font):
points = {
{{600.,-20.},{518.,-20.},{452.,46.},{452.,128.}},
{{452.,128.},{452.,210.},{518.,276.},{600.,276.}},
{{600.,276.},{682.,276.},{748.,210.},{748.,128.}},
{{748.,128.},{748.,46.},{682.,-20.},{600.,-20.}}
};
Graphics /@ {
{
PointSize[0.02], Point @ Flatten[points, 1],
BezierCurve /@ points,
Opacity[0.2, Blue], FilledCurve[BezierCurve /@ points]
},
{
PointSize[0.02], Point @ Flatten[points, 1],
BSplineCurve /@ points,
Opacity[0.2, Red], FilledCurve[BSplineCurve /@ points]
}
} // GraphicsRow
- Black "circle": drawn by
BezierCurve
orBSplineCurve
- Blue region:
FilledCurve @ BezierCurve
- Red region:
FilledCurve @ BSplineCurve
Why the curve and the filled region do no fit whether I use BezierCurve
or BSplineCurve
?
BezierCurve
corners make sense because it's actually a collection of splines glued together in a C0 continuous way.BSplineCurve
looks smoother because they're joined in a C2 continuous way. There is unfortunately no way to make an exact circle with these splines - but you can get close - look at this answer stackoverflow.com/questions/1734745/… $\endgroup$FilledCurve[]
? Try omitting the first point of the second, third, and fourth set of control points before feeding toFilledCurve[]
:Graphics[{PointSize[0.02], Point @ Flatten[points, 1], BezierCurve /@ points, Opacity[0.2, Blue], FilledCurve[BezierCurve /@ Join[{First[points]}, Drop[points, 1, 1]]]}]
$\endgroup$