Skip to main content
7 of 22
added 188 characters in body
cvgmt
  • 91.7k
  • 6
  • 113
  • 194

Edit

Clear["Global`*"]; curves[x_] := {{-(Sqrt[3^2 - x^2]/2), -(Sqrt[3^2 - x^2]/2), x}, {Sqrt[3^2 - x^2]/2, -(Sqrt[3^2 - x^2]/2), x}, {(Sqrt[3^2 - x^2]/2), Sqrt[3^2 - x^2]/2, x}, {-Sqrt[3^2 - x^2]/2, Sqrt[3^2 - x^2]/2, x}}; lines = ParametricPlot3D[curves[x], {x, 0, 3}, BoxRatios -> Automatic]; surface = ParametricPlot3D[{1 - s, s} . # & /@ Partition[curves[x], 2, 1, 1], {x, 0, 3}, {s, 0, 1}, Boxed -> False, Mesh -> None, PlotStyle -> Opacity[.2], Axes -> False]; Show[lines, surface, Graphics3D[{FaceForm[Directive@{Opacity[.5], Yellow}], Polygon[curves[1.5]], FaceForm[], EdgeForm[Directive@{Orange, Thick}], Polygon[curves[0]]}], Boxed -> False, Axes -> False] 

enter image description here

Original

  • A staring point.
  • We draw the intersection line of two cylinders.
ContourPlot3D[{x^2 + z^2 == 3^2, y^2 + z^2 == 3^2}, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}] 

enter image description here

Clear["Global`*"]; plot = Plot3D[z = Sqrt[3^2 - y^2], {x, -3, 3}, {y, -3, 3}, Mesh -> {{0}}, MeshFunctions -> Function[{x, y, z}, z - Sqrt[3^2 - x^2]], MeshStyle -> Directive@{Thick, Red}, PlotPoints -> 150, MaxRecursion -> 4, PlotStyle -> None, BoundaryStyle -> None, Boxed -> False, Axes -> False, BoxRatios -> Automatic]; square[x_] := Graphics3D[{FaceForm[], EdgeForm[Blue], GeometricTransformation[ Polygon[{{-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}}], TranslationTransform[{0, 0, x}]@* ScalingTransform[Sqrt[3^2 - x^2]*{1, 1, 1}]]}]; n=2; Show[plot, Table[square[x], {x, Subdivide[0, 3, n]}], BoxRatios -> Automatic] 

enter image description here

n=25; Show[plot, Table[square[x], {x, Subdivide[0, 3, n]}], BoxRatios -> Automatic, ViewPoint -> {1, 1, 2}] 

enter image description here

cvgmt
  • 91.7k
  • 6
  • 113
  • 194