8
$\begingroup$

I think I've identified a bug in how VertexColors are treated when rendering a Tube object where the underlying data is a BSplineCurve (it also affects BezierCurve), it appears that the colors of the tube are "snapping" to the nearest primitive colors for some reason. Here's a minimum working example that should produce an Orange Tube object, but the object is definitively Red in color:

Graphics3D[{Tube[BSplineCurve[{{0, 0, 0}, {0, 0, 1}}], 0.05,
VertexColors -> {Orange, Orange}]},
PlotRange -> {{-0.1, 0.1}, {-0.1, 0.1}, Automatic},
Boxed -> False, Lighting -> "Neutral"]

enter image description here

Some testing has shown that which color is snapped to is very sensitive to the particular vertex colors chosen, for instance setting the VertexColors argument to {Hue[0.166],Hue[0.167]} renders a tube with one end green and one end red:

enter image description here

Get rid of the BSplineCurve within the Tube call and the object has the proper color:

enter image description here

This is in Mathematica 9 on Mac OS X 10.10.2, but I have verification that this behavior persists in the latest version of Mathematica 10 (10.0.2) for Windows (thanks Mr. Wizard!).

If this is indeed a bug, is there a work-around aside from abandoning BSplineCurve? It would be preferable for me to be able to render Tube objects smoothly.

$\endgroup$
5
  • $\begingroup$ I guess I'm not supposed to tag my own question as a bug, but this really does seem like a bug. Should I tag it as such? $\endgroup$
    – Guillochon
    Apr 22, 2015 at 13:43
  • $\begingroup$ I do not think this should be tagged as a bug yet; it hasn't had enough attention. I added a tag that might generate more interest. If that fails I'll add a bounty. By the way the behavior persists in 10.1.0. $\endgroup$
    – Mr.Wizard
    May 5, 2015 at 10:31
  • $\begingroup$ Confirmed with v9 and v10.1.0 (OSX 10.9.5) $\endgroup$
    – SquareOne
    May 5, 2015 at 10:57
  • $\begingroup$ This workaround works for me :Graphics3D[{Orange, Tube[BSplineCurve[{{0., 0., 0.}, {0., 0., 1.}}], 0.05]}, PlotRange -> {{-0.1, 0.1}, {-0.1, 0.1}, Automatic}, Boxed -> False, Lighting -> "Neutral"] but it might be probably too basic for more complex plots ? $\endgroup$
    – SquareOne
    May 5, 2015 at 12:44
  • $\begingroup$ @SquareOne The issue is when you set the vertex colors, not when you set the color of the entire object as you do in your code. In the simple example I had provided both vertexes have the same color. $\endgroup$
    – Guillochon
    May 5, 2015 at 17:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.