MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Colorfunction + parametricplot3d + plotrange = ?

This is a bug.  It affects a Line with VertexColors that goes outside 
the PlotRange of a Graphics3D object, such as the one produced by a 
ParametricPlot3D of one parameter with a ColorFunction where the 
curve is outside the PlotRange.  The issue has been corrected in the 
internal development build and the fix will appear in a future release.

A workaround is to prevent the curve from leaving the 
PlotRange.  Here I do this by using RegionFunction to clip the curve 
to the desired range, change the PlotRange to All, and add 8 dummy 
polygons to make the PlotRange at least as big as the desired range.

With[{plotRange = {{-6, 6}, {-6, 6}, {-6, 6}}},
  ParametricPlot3D[{5*Cos[fi], 5*Sin[fi], fi}, {fi, 0, 2 Pi},
    ColorFunction -> Function[{xx, yy, zz}, If[zz < 2, Red, Blue]],
    PlotStyle -> {Thickness[0.01]}, ColorFunctionScaling -> False,
    PlotRange -> All,
    RegionFunction ->
     With[{plotRangeRegion =
        And @@ MapIndexed[And[Slot @@ #2 >= First[#], Slot @@ #2 <= Last[#]] &,
           plotRange]}, plotRangeRegion &]] /.
   Graphics3D[prims_, opts___] :>
    Graphics3D[{Polygon[Table[#, {3}] & /@ Tuples[plotRange]], prims}, opts]]

Sorry for the inconvenience and I hope the workaround is helpful.

Chris Hill
Wolfram Research 

  • Prev by Date: Re: Convert Graphics3D to Graphics2D. Is it possible?
  • Next by Date: Error code: 480
  • Previous by thread: Re: Colorfunction + parametricplot3d + plotrange = ?
  • Next by thread: Re: Colorfunction + parametricplot3d + plotrange = ?