3
$\begingroup$

I am trying to plot one (or two) flat semi circles that are filled, and the filling is transparent.

Looking at some examples online I have come up with the following:

ParametricPlot3D[{{10 Cos[u], v, -10 Sin[u]}, {v, 10 Cos[u], -10 Sin[u]}}, {u, 0, Pi}, {v, 0.1, -0.1}] /. Line[l_List] :> {{Opacity[0.1], Red, Polygon[l]}, {Black, Line[l]}}

Which gives me the following figure:

enter image description here

While this is great, it is not possible to see through the regions. For example, one cannot see one of the semi-circles through the other. And If I put any other 3D object in there, it is also hidden by the region. So while Opacity makes the red shade lighter, it is not transparent.

Any idea of how to make this transparent/translucid?

Does not need to be parametric, as long as it is 3D will do.

$\endgroup$
7
$\begingroup$

Reply to the Comment

Given a fixed point {x0,y0,z0} and a parametric space curve h[u_]:={10 Cos[u], 0, 10 Sin[u]}, we can construct lines from {x0,y0,z0} to h[u] by {x0,y0,z0}+ t*(h[u]-{x0,y0,z0}), here 0<=t<=1, that is the way to construct such surface.

Original

f[u_, t_] := {0, 0, 1} + t*{10 Cos[u], 0, -10 Sin[u]};
g[u_, t_] := {0, 0, 1} + t*{0, 10 Cos[u], -10 Sin[u]};
ParametricPlot3D[{f[u, t], g[u, t]}, {u, 0, Pi}, {t, 0, 1}, 
 PlotStyle -> {{Red, Opacity[.5]}, {Green, Opacity[.5]}}, 
 Mesh -> None, PlotRange -> All, BoundaryStyle -> {Thick, Gray}, 
 PlotPoints -> 50]

We can change the center of semi-circle and the range of u to get another semi-circle.

f[u_, t_] := {0, 0, 0} + t*({10 Cos[u], 0, 10 Sin[u]}-{0,0,0});
g[u_, t_] := {0, 0, 0} + t*({0, 10 Cos[u], 10 Sin[u]}-{0,0,0});
ParametricPlot3D[{f[u, t], g[u, t]}, {u, 0, Pi}, {t, 0, 1}, 
 PlotStyle -> {{Red, Opacity[.5]}, {Green, Opacity[.5]}}, 
 Mesh -> None, PlotRange -> All, BoundaryStyle -> {Thick, Gray}, 
 PlotPoints -> 50]

enter image description here

enter image description here

$\endgroup$
3
  • $\begingroup$ So this is a bit strange, to me at least; can you clarify if this is successful due to the use of two separate surfaces/regions? $\endgroup$ – CA Trevillian Jun 22 at 1:53
  • $\begingroup$ @CATrevillian Use two parametrics to construct a surface. See the updated. $\endgroup$ – cvgmt Jun 22 at 2:09
  • $\begingroup$ That worked out amazingly. thank you. $\endgroup$ – Mac Jun 25 at 17:36
6
$\begingroup$
SliceContourPlot3D[ x^2 + y^2 + z^2,
 {x == 0, y == 0}, 
 {x, y, z} ∈ Ball[], 
 Contours -> {{1}}, 
 ContourShading -> Opacity[.5, Red], 
 BoundaryStyle -> {Thick, Black},
 RegionFunction -> (#3 >= 0 &)]

enter image description here

$\endgroup$
4
$\begingroup$

One more hackneyed way repurposing some old code that had very short cylinders.

Graphics3D[
 {{Orange, Opacity[0.1], EdgeForm[Thick], 
   Cylinder[{{1, 1, 0.99}, {1, 1, 1}}, 1]},
  {Blue     , Opacity[0.1], EdgeForm[Thick], 
   Cylinder[{{0.99, 1, 1}, {1, 1, 1}}, 1]}},
 Axes -> True,
 AxesLabel -> {x, y, z},
 ImageSize -> 450,
 PlotRange -> {{0, 2}, {0, 1}, {0, 2}}
 ]

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.