6
$\begingroup$

Bug introduced in 11.3 or earlier and fixed in 12.1


I am running Mathematica 11.3 and would like to see if this behavior is still present in newer versions of Mathematica before submitting a bug report.


Here is my example code

triangle[txtrq_] := 
 Module[{arcs = {
     BSplineCurve[{{1, 0}, {1, Sqrt[3]/3}, {1/2, Sqrt[3]/2}},
      SplineWeights -> {1, Sqrt[3]/2, 1}], 
     BSplineCurve[{(*{1/2,Sqrt[3]/2},*){0, Sqrt[3]/3}, {0, 0}}, 
      SplineWeights -> {1, Sqrt[3]/2, 1}], 
     BSplineCurve[{(*{0,0},*){1/2, -Sqrt[3]/6}, {1, 0}}, 
      SplineWeights -> {1, Sqrt[3]/2, 1}]}, txtr}, 
  txtr = Graphics[{Thickness[1/8], RGBColor[1, 7/8, 0], 
     Line[{{{0, 1/2}, {1/2, 1}}, {{1/2, 0}, {1, 1/2}},
         {{0, 1/2}, {1/2, 0}}, {{1/2, 1}, {1, 1/2}}}]}, 
    PlotRange -> {{0, 1}, {0, 1}}]; 
  Graphics[{Sequence @@ If[txtrq, {Texture[txtr]}, {}], 
    RGBColor[1, 7/8, 0], 
    FilledCurve[arcs, 
     Sequence @@ 
      If[txtrq, {VertexTextureCoordinates -> 
         20 {{1, 0}, {1, Sqrt[3]/3}, {1/2, Sqrt[3]/2},
           (*{1/2, Sqrt[3]/2},*){0, Sqrt[3]/3}, {0, 0},
           (*{0, 0},*){1/2, -Sqrt[3]/6}, {1, 0}}}, {}]], 
    RGBColor[1/5, 1/2, 1], Thickness[1/50], 
    JoinedCurve[arcs, CurveClosed -> True]}, ImageSize -> 400]]

Note that I have commented out the first point in all but the first of the BSplineCurve structures in arcs and the corresponding points in the VertexTextureCoordinates. This is explained in the answers to this question.


Here is the output with the Texture and VertexTextureCoordinates removed:

triangle[False]

enter image description here

Here is the output with the Texture and VertexTextureCoordinates included:

triangle[True]

enter image description here

Note that the JoinedCurve is closed in the absence of the Texture in the FilledCurve. However, when the Texture is present in the FilledCurve, the JoinedCurve fails to close (the bottom right corner lacks its mitered join). It seems odd that an option to one graphics directive causes a problem in the rendering of another.

Does this behavior persist in newer versions of Mathematica?

$\endgroup$
11
  • 1
    $\begingroup$ Can you try adding Directive[JoinForm["Round"], CapForm["Round"]] before all the other primitives to see what happens? $\endgroup$ – J. M.'s torpor Feb 2 at 14:32
  • $\begingroup$ I'm on MMA 12.0.0.0 on Mac and the problem persists. $\endgroup$ – N.J.Evans Feb 2 at 14:33
  • 1
    $\begingroup$ @J.M.'sennui: I did an image difference, and there is a small difference at the two joins of both drawings: the round join is very small, but those joins are "Round". The caps are still "Butt". $\endgroup$ – robjohn Feb 2 at 14:58
  • 1
    $\begingroup$ Work fine in 12.2. The bug had been fixed. $\endgroup$ – cvgmt Feb 2 at 15:15
  • 1
    $\begingroup$ @DanielHuber: Thanks! I already have 12.1, but I need to update my OS before it will run. This adds a reason to do so. $\endgroup$ – robjohn Feb 2 at 22:00
6
$\begingroup$

The bug had been fixed. Here we attach the result.

$Version
(* 12.2.0 for Linux x86 (64-bit) (December 9, 2020) *)
Row[triangle /@ {True, False}]

enter image description here

$\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.