6
$\begingroup$

While adding shadows to the spiric sections of a torus using the The answer to the question given by Daniel Huber, I faced a problem.

Instead of being well separated as previously, the sections overlap. How to make them well-spaced as previously with their shadows on the lower wall face?

For shadow, I used an answer by Eldo using DropShadow developed by Michael Sollami

DropShadow = ResourceFunction["DropShadow"];


seg = {{-5, -4.5}, {-4.5, -3.5}, {-3.5, 0}, {0, 3.5}, {3.5, 
    4.5}, {4.5, 5}};
shift = {-5, -3, -1, 1, 3, 5};

gr = MapThread[
   DropShadow[
     ParametricPlot3D[{0, #2, 
        0} + {(4 + Cos[\[Phi]])*Cos[\[Theta]], (4 + Cos[\[Phi]])*
         Sin[\[Theta]], Sin[\[Phi]]}, {\[Phi], 0, 2 \[Pi]}, {\[Theta],
        0, 2 \[Pi]}, 
      RegionFunction -> 
       Function[{x, y, z}, #1[[1]] < y - #2 < #1[[2]]], 
      PlotPoints -> 10, ImageSize -> 800, Axes -> False, 
      Boxed -> False, ViewPoint -> {-2, - 1.3, 1.25}], "Blur" -> 25, 
     "Color" -> Gray, "Opacity" -> .5, 
     "Offset" -> {-10, 20}] &, {seg, shift}];
Show[gr, PlotRange -> All]

enter image description here

$\endgroup$

1 Answer 1

10
$\begingroup$
  • My answer keep the mesh with the same shape.
  • Show all the parts and then use the ResourceFunction["DropShadow"].
Clear["Global`*"];
R = 4; r = 1;
g[a_, b_] := 
  RevolutionPlot3D[{R + r*Cos[t], r*Sin[t]}, {t, 0, 
    2   Pi}, {θ, 0, 2   π}, Boxed -> False, Axes -> False, 
   MeshFunctions -> {#4 &, #5 &}, 
   Mesh -> {Subdivide[0, 2  Pi, 30], Subdivide[0, 2  Pi, 40]}, 
   RegionFunction -> Function[{x, y, z, t, θ}, a <= y <= b]];
list = {g[-(R + r), -(R + r/2)], g[-(R + r/2), -R], g[-R, -(R - r)], 
   g[-(R - r), 0], g[0, R - r], g[R - r, R], g[R, R + r/2], 
   g[R + r/2, R + r]};
plot = Show[
   Table[Graphics3D[
     GeometricTransformation[list[[i]][[1]], 
      TranslationTransform[{0, 2  i, 0}]]], {i, 1, Length@list}], 
   Boxed -> False, ViewPoint -> {-2, -1.3, 1.25}];

DropShadow = ResourceFunction["DropShadow"];
DropShadow[plot, "Blur" -> 15, "Color" -> Gray, "Opacity" -> .8, 
 "Offset" -> {-10, 20}]

enter image description here

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.