10
$\begingroup$

Bug introduced in V9.0 or earlier and persisting through V11.3


Here's an example:

Graphics[
    GraphicsComplex[
        {{-1, 0}, {0, 1}, {1, 0}}, 
        BSplineCurve[{1, 2, 3}, SplineClosed -> True]
    ],
    PlotRange -> 1.1, Axes -> True
]

enter image description here

works well, but when we add FilledCurve over BSplineCurve, it doesn't anymore.

FilledCurve @ BSplineCurve[{1,2,3}, SplineClosed -> True]

enter image description here


The workaround is to keep it outside GraphicsComplex:

Graphics[{
  FilledCurve @ BSplineCurve[{{-1, 0}, {0, 1}, {1, 0}}, SplineClosed -> True], 
  GraphicsComplex[{{-1, 0}, {0, 1}, {1, 0}}, Line[{1, 2, 3}]]
  },
  PlotRange -> 1.1, Axes -> True
]

enter image description here

But this just adds work which I would like to avoid. Is it possible?

Could that problem have been anticipated?


Edit: Here's a response from WRI:

It does appear as though GraphicsComplex is misbehaving with the FilledCurve option applied to BSplineCurve. I have thus filed a report with our developers so that they may look in to the issue.

In the meantime, as a workaround you could use replacement rules to get behavior similar to the GraphicsComplex functionality:

Graphics[
    FilledCurve@BSplineCurve[{1, 2, 3}, SplineClosed -> True], 
    PlotRange -> 1.1, Axes -> True
] /. Thread[Range[3] -> {{-1, 0}, {0, 1}, {1, 0}}]
$\endgroup$
4
$\begingroup$

Not very clean:

v = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

r = Normal /@ {Graphics[GraphicsComplex[v, Polygon[{1, 2, 3, 4}]]], 
               Graphics[GraphicsComplex[v, {Red, Line[{1, 2, 3, 4, 1}]}]]};

r /. {Red, Line[x__]} :> (FilledCurve@Line@x)

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.