3
$\begingroup$

I want to plot a schematic diagram of this

enter image description here or enter image description here

So far, I am able to plot thisenter image description here using the code provided below.

I am having a problem with ClipPlanes

Graphics3D[Cylinder[{{0, 0, -4}, {0, 0, 2}}, 1], Axes -> True, 
 ClipPlanes -> {InfinitePlane[{{2.5, 2.5, 2.5}, {2.5, 3, 3}, {5, 5, 
      5}}], Rotate[
    InfinitePlane[{{2.5, 2.5, 2.5}, {0, 0.25, 3}, {0, 0, 5}}], 
    180*Degree, {0, 0, 1}]}]

Please do help me out.

$\endgroup$

1 Answer 1

2
$\begingroup$
  • Using HalfSpace can clip the solid of cylinder.
cylin0 = Cylinder[{{0, 0, -4}, {0, 0, 2}}, 1];
cylin1 = BoundaryDiscretizeRegion[cylin0, MaxCellMeasure -> .01];
space1 = 
  BoundaryDiscretizeGraphics[HalfSpace[{1, 0, 1}, {1, 0, 0}], 
   PlotRange -> 200];
space2 = 
  BoundaryDiscretizeGraphics[HalfSpace[{1, 0, -1}, {1, 0, 0}], 
   PlotRange -> 200];
Graphics3D[{{EdgeForm[], FaceForm[{Opacity[.9], Lighter@Cyan}], 
   RegionIntersection[cylin1, space1, 
    space2]}, {{AbsolutePointSize[10], Red, Point[{1, 0, 0}]}, 
   Opacity[.2], cylin0}}, Lighting -> "ThreePoint", Boxed -> False]

enter image description here

  • Using four ClipPlane to get another result.
Clear["Global`*"];
cylin0 = Cylinder[{{0, 0, -4}, {0, 0, 2}}, 1];
Graphics3D[{{ClipPlanes -> {Flatten@{-{1, 0, 1}, {1, 0, 1} . {1, 0, 
         0}}, Flatten@{-{1, 0, -1}, {1, 0, -1} . {1, 0, 0}}}, Cyan, 
   cylin0}, {ClipPlanes -> 
    Flatten@{{1, 0, 1}, -{1, 0, 1} . {1, 0, 0}}, Opacity[.2], cylin0, 
   ClipPlanes -> Flatten@{{1, 0, -1}, -{1, 0, -1} . {1, 0, 0}}, 
   cylin0}}, Boxed -> False]

enter image description here

$\endgroup$
0

Your Answer

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

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