This may be related to How to discretize a BezierCurve?, but this question deals with BSplineCurve
s with specific SplineWeights
, so I don't think the answers there will help here.
Background
I am using version 11.3.0.0 (on Mac OS 10.11.5).
I recently wrote an Arc
function that takes the same arguments as Circle
. This spits out a list of degree 2 BSplineCurve
s with the appropriate SplineWeights
to generate pieces of a circle. I did this so that the last piece can be wrapped in an Arrow
to make circular-arc arrows.
I also wanted to use JoinedCurve
and FilledCurve
with the arcs, which cannot be done with Circle
.
The Problem
The code
segments = {
BSplineCurve[{{1,0},{1,1},{0,1}},SplineWeights->{1,1/Sqrt[2],1}],
BSplineCurve[{{0,1},{-1,1},{-1,0}},SplineWeights->{1,1/Sqrt[2],1}]
};
Graphics[{{Red,segments},JoinedCurve[segments]}]
produces the output
The red curve is drawn first and seems to be correct. The black curve is drawn second and overlays the first segment properly; however, the second segment doesn't quite follow the red circle. Ideally, the black curve should completely obscure the red curve.
I was thinking that the problem might be that that JoinedCurve
was trying to use a cubic spline to try to match the quadratic rational spline; however, then the first segment would not overlay so precisely (a cubic spline cannot exactly trace an arc of a circle unless it employs the proper weights).
The same problem is displayed by FilledCurve
:
segments = {
BSplineCurve[{{1/4,-3/4},{1,-3/4},{1,0}},SplineWeights->{1,1/Sqrt[2],1}],
BSplineCurve[{{1,0},{1,3/4},{1/4,3/4}},SplineWeights->{1,1/Sqrt[2],1}],
Line[{{1/4,3/4},{-1/4,3/4}}],
BSplineCurve[{{-1/4,3/4},{-1,3/4},{-1,0}},SplineWeights->{1,1/Sqrt[2],1}],
BSplineCurve[{{-1,0},{-1,-3/4},{-1/4,-3/4}},SplineWeights->{1,1/Sqrt[2],1}],
Line[{{-1/4,-3/4},{1/4,-3/4}}]
};
Graphics[{{Red,segments},Lighter[Purple,3/4],FilledCurve[segments]}]
Does anyone know what is going on here, and whether this persists in newer versions as well.
The Masked Pumpkin
This problem arose when I was creating my Gravatar for Halloween 2020:
Hopefully, I can remove the mask by next Halloween.