0
$\begingroup$

I'm using Show to merge Graphics3D with different 3D Plots. For example:

Show[
 Graphics3D[{
   {PointSize@0.05, Point[{0, 0, 0}]},
   {Thick, Arrow@{{0, 0, 0}, {-1, 0, 0}}},
   {Text[Style["x=-0.5, y=0, z=-0.2", Medium, Bold], {-0.5, 0, -0.2}]}
  }],
 RevolutionPlot3D[{t, 0}, {t, 0, 1}, Mesh -> None],
 Boxed -> False,
 Axes -> False
]

However, as seen in the image, graphics primitives get partially overdrawn by 3d plot. So how can one enforce mathematica to render Graphics3D over any other 3D plots?

$\endgroup$
10
  • $\begingroup$ Would Sphere[] and Tube[] be suitable? Show[Graphics3D[{Black, Sphere[{0, 0, 0}, 1/20], Arrowheads[Large], Arrow[Tube[{{0, 0, 0}, {-1, 0, 0}}, 1/50]]}], RevolutionPlot3D[{t, 0}, {t, 0, 1}, Mesh -> None], Boxed -> False] $\endgroup$ May 11, 2017 at 15:21
  • $\begingroup$ Well, first of all I have a lot of other complicated combinations of plots and graphics, the case above is just a simplified example. Second - even if i replace them with sphere and tube - they are still not being rendered above the plot. $\endgroup$ May 11, 2017 at 15:37
  • $\begingroup$ It's a 3D model: Objects intersect or lie in between things and the view point. I'm not sure what you expect. You could try Overlay, if that's what you're after, but that will mess up rotation. $\endgroup$
    – Michael E2
    May 11, 2017 at 15:40
  • 1
    $\begingroup$ @J.M. Axes, too. It would be nice to have a rendering directive that would overlay primitives like Text is done. $\endgroup$
    – Michael E2
    May 11, 2017 at 18:06
  • 1
    $\begingroup$ Have you tried using Opacity ( PlotStyle->Opacity[.5] in RevolutionPlot3D ) ? $\endgroup$
    – george2079
    May 11, 2017 at 20:03

2 Answers 2

1
$\begingroup$

Another idea. Given that a comment indicated that the use-case is "complicated", I'm not sure it suffices. You can use Texture to apply graphics/images to one or both sides of a surface:

Both sides:

RevolutionPlot3D[{t, 0}, {t, 0, 1}, Mesh -> None, 
 PlotStyle -> 
  Texture[Graphics[{{PointSize@0.03, Point[{0, 0}]}, {Thick, 
      Arrow@{{0, 0}, {-1, 0}}}}, PlotRange -> 1]],
 TextureCoordinateFunction -> ({#1, #2} &), Boxed -> False, 
 Axes -> False
 ]

Just the "top" (as defined by RevolutionPlot and FaceForm):

RevolutionPlot3D[{t, 0}, {t, 0, 1}, Mesh -> None, 
 PlotStyle -> 
  FaceForm[Texture[
    Graphics[{{PointSize@0.03, Point[{0, 0}]}, {Thick, 
       Arrow@{{0, 0}, {-1, 0}}}}, PlotRange -> 1]], White],
 TextureCoordinateFunction -> ({#1, #2} &), Boxed -> False, 
 Axes -> False
 ]
$\endgroup$
1
  • $\begingroup$ Interesting idea. However flattening graphics onto surface is indeed not a desirable effect. $\endgroup$ May 11, 2017 at 16:07
1
$\begingroup$

In:

g1 = Graphics3D[{{PointSize@0.05, Point[{0, 0, 0}]}, {Thick, 
     Arrow@{{0, 0, 0}, {-1, 0, 0}}}}];
g2 = RevolutionPlot3D[{t, 0}, {t, 0, 1}, Mesh -> None];
plotRange = {{-1, 1}, {-1, 1}, {-1, 1}};
Graphics3D[{Translate[g1[[1]], {0, 0, 0.08}], g2[[1]]}, 
 AspectRatio -> 1, Boxed -> False, PlotRange -> plotRange]

Out:

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ Nice trick ;) However it won't work in my use-case. $\endgroup$ May 11, 2017 at 16:10

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.