2
$\begingroup$
gam = 0; b = 1;
a = 2;
p20 = ParametricPlot3D[{a Cos[u], a Sin[u] Cos[gam] + b v Sin[gam], 
    b v}, {u, 0, 2 Pi}, {v, -8, 8}, 
   PlotStyle -> {Yellow, Opacity[.3]}];
a = 1.5;
p15 = ParametricPlot3D[{a Cos[u], a Sin[u] Cos[gam] + b v Sin[gam], 
    b v}, {u, 0, 2 Pi}, {v, -8, 8},
   PlotStyle -> {Yellow, Opacity[.3]}];
a = 1.0;
p10 = ParametricPlot3D[{a Cos[u], a Sin[u] Cos[gam] + b v Sin[gam], 
    b v}, {u, 0, 2 Pi}, {v, -8, 8}, 
   PlotStyle -> {Yellow, Opacity[.3]}];
a = 0.5;
p05 = ParametricPlot3D[{a Cos[u], a Sin[u] Cos[gam] + b v Sin[gam], 
    b v}, {u, 0, 2 Pi}, {v, -8, 8}, 
   PlotStyle -> {Yellow, Opacity[.3]}];
a = 4;
cyl = ParametricPlot3D[{a Sin[u] Cos[gam] + b v Sin[gam] - 4, b v, 
   a Cos[u]}, {u, 0, 2 Pi}, {v, -3, 3}, 
  PlotStyle -> {Purple, Opacity[.6]}]
Show[{p20, p15, p10, p05, cyl}, PlotRange -> All]

How to remove ( so as not to be seen in display) the cut tubular portions lying inside bigger purple cylinder? There may a single code line to see all the shell assembly intersections without repetition. I don't seem to get it always right..Thanks.

$\endgroup$
1
$\begingroup$
ParametricPlot3D[Evaluate[Append[Table[
  ConditionalExpression[{a Cos[u], a Sin[u] Cos[gam] + b v Sin[gam], b v}, 
   (a Cos[u] + 4)^2 + (b v)^2 >= 16], {a, {2, 1.5, 1., .5}}],
  ConditionalExpression[{4 Sin[u] Cos[gam] + b v Sin[gam] - 4, b v, 4 Cos[u]},
    -3 <= v <= 3]]], {u, 0, 2 Pi}, {v, -8, 8}, 
 PlotStyle -> Append[Table[Opacity[.3, Yellow], {4}], Opacity[.6, Purple]], 
 PlotRange -> All,  PerformanceGoal -> "Quality", Mesh -> None ]

enter image description here

Update: Highlighting the boundaries:

plots = Table[ParametricPlot3D[{a Cos[u], a Sin[u] Cos[gam] + b v Sin[gam], b v}, 
   {u, 0, 2 Pi}, {v, -8, 8}, 
   PlotStyle -> Opacity[.2, Yellow], Mesh -> None, PerformanceGoal -> "Quality", 
   RegionFunction -> ((a Cos[#4] + 4)^2 + (b #5)^2 >= 16 &)], 
 {a, {2, 1.5, 1., .5}}];

boundaries = Table[ParametricPlot3D[{a Cos[u], a Sin[u] Cos[gam] + b v Sin[gam], b v}, 
   {u, 0, 2 Pi}, {v, -8, 8}, 
   MeshFunctions -> {(a Cos[#4] + 4)^2 + (b #5)^2 - 16 &}, 
   Mesh -> {{0}}, MeshStyle -> Directive[Red, Thick], PlotStyle -> None], 
 {a, {2, 1.5, 1., .5}}] /. Line -> ({Red, Tube[#, .1]} &);

cyl = ParametricPlot3D[{4 Sin[u] Cos[gam] + b v Sin[gam] - 4, b v, 4 Cos[u]}, 
  {u, 0, 2 Pi}, {v, -3, 3}, Mesh -> None, PlotStyle -> Opacity[.6, Purple]];

Show[plots, boundaries, cyl, PlotRange -> All

enter image description here

$\endgroup$
  • $\begingroup$ Can we draw intersecting ovals with more contrasting lines? $\endgroup$ – Narasimham Jan 4 '18 at 8:13
  • $\begingroup$ @Narasimham, maybe playing with BoundaryStyle settings may give what you are asking, but i have not been able make it work in version 9. $\endgroup$ – kglr Jan 4 '18 at 8:47
0
$\begingroup$

using region tools.

c1[r_] := 
  ImplicitRegion[
   x^2 + y^2 == r^2 , {{x, -5, 5}, {y, -5, 5}, {z, -8, 8}}];
c2 = ImplicitRegion[(x - 2)^2 + z^2 == 
   3^2 , {{x, -5, 5}, {y, -5, 5}, {z, -8, 8}}]
c2s = ImplicitRegion[(x - 2)^2 + z^2 < 
   3^2 , {{x, -5, 5}, {y, -5, 5}, {z, -8, 8}}]
Show[{
  DiscretizeRegion[c2, 
   MeshCellStyle -> {{2, All} -> {Opacity[.5], Purple}}],
  Table[
   {DiscretizeRegion[RegionDifference[c1[r], c2s], 
     MeshCellStyle -> {{2, All} -> {Opacity[.5], Orange}}], 
    DiscretizeRegion[RegionIntersection[c1[r], c2], 
     MeshCellStyle -> {{1, All} -> {Thickness[.01], Red}}]}, {r, {1, 
     1.5, 2}}]}]

enter image description here enter image description here

( note MeshCellStyle here needs v 11 )

$\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.