4

I often find that Graphics3D drawings appear "streaky" in places. This can be seen in the picture below (taken from my question here).

cone2 projected onto cone1

There is an unattractive patch where the colour changes unpredictably where the blue and pink cones overlap at the bottom. Presumably this is something to do with having the two surfaces being directly on top of each other, but I think have seen the same phenomenon occurring even when this is not the case. You can see the same behaviour in Mathematica's documentation on Cone (under Applications, the 2nd example "Define a region by the intersection of a cone and a plane"):

streakiness example from Mathematica documentation

Is there any way to fix this? Sometimes altering the coordinates slightly so that the two surfaces don't quite overlap seems to help, but it's not a very elegant solution...

I believe this is the same issue as presented in 3DPlot Rendering Artefacts (z-fighting) but the solution there does not exactly address my problem.

  1. I am dealing with a Graphics3D object rather than a plot, so it is not immediately obvious what is the best parameter to alter by 1% to make the cone surfaces not quite overlap. (Altering Scale[cone2, 3, {0, 0, 0}] to Scale[cone2, {3.01, 3.01, 3}, {0, 0, 0}] seems to work but maybe there is a better way.)
  2. I am already aware of this general method of altering the coordinates slightly and am wondering if there is an alternative solution.
Antony
  • 71
  • 3

1 Answers1

3

I can think of no solution to the color streaking problem other than perturbing the size of one the two coinciding cones. I choose to perturb projcone2.

origin = Point[{0, 0, 0}];
cone1 = Cone[{{0, 0, 1}, {0, 0, 0}}];
transform = {{0.3, 0, 0.15}, {0, 0.35, 0}, {0.1, 0, 0.5}};
cone2 = GeometricTransformation[cone1, transform];
projcone2 = Scale[cone2, {2.99, 2.99, 3}, {0, 0, 0}];

Graphics3D[
  {{Opacity[0.25], EdgeForm[{Thick}], cone1}, 
   {Opacity[0.6], Magenta, EdgeForm[Thick], cone2}, 
   {Opacity[0.6], Cyan, EdgeForm[{Thick}], projcone2},
   {PointSize[Large], origin}},
  Lighting -> "Neutral",
  PlotRange -> 1.4 {{-1, 1}, {-1, 1}, {0, 1.4}},
  ImageSize -> Large]

cones

This graphic also shows you why you are not seeing the edge of projcone2 in your rendering of the cones. The edge lies outside the range of your bounding box.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257