5
$\begingroup$

I know how to find the region of intersection of these cylinders using integration, but how would I plot that in mathematica? This is what I have

ContourPlot3D[{x^2 + y^2 == 1, x^2 + z^2 == 1, 
  y^2 + z^2 == 1}, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, 
 AxesLabel -> Automatic, PlotLegends -> "Expressions"]

This is what I have so far

$\endgroup$
4
  • $\begingroup$ The intersection of the three surfaces would be eight points. You could use Solve[] to find them $\endgroup$
    – Michael E2
    Commented Jun 22, 2019 at 23:07
  • $\begingroup$ Possibly related: mathematica.stackexchange.com/q/100825/4999 $\endgroup$
    – Michael E2
    Commented Jun 22, 2019 at 23:10
  • $\begingroup$ How would I do that? by defining an InfinitePlane through the points on the cylinder? $\endgroup$ Commented Jun 23, 2019 at 0:02
  • $\begingroup$ Use Solve[] with the three equations $\endgroup$
    – Michael E2
    Commented Jun 23, 2019 at 4:50

3 Answers 3

7
$\begingroup$

You can use region functionality for this. Here is the intersection of the boundary of the cylinders:

reg = RegionIntersection[
    RegionBoundary @ Cylinder[{{0,0,-2},{0,0,2}}],
    RegionBoundary @ Cylinder[{{0,-2,0},{0,2,0}}],
    RegionBoundary @ Cylinder[{{-2,0,0},{2,0,0}}]
];

Here is a visualization of the points of intersection:

mesh = DiscretizeRegion[reg, MeshCellStyle -> {0 -> Directive[Red, PointSize[Large]]}]

enter image description here

And the values of the intersection:

MeshPrimitives[mesh, 0]

{Point[{0.707107, 0.707107, -0.707107}], Point[{-0.707107, -0.707107, 0.707107}], Point[{0.707107, 0.707107, 0.707107}], Point[{-0.707107, -0.707107, -0.707107}], Point[{0.707107, -0.707107, 0.707107}], Point[{-0.707107, 0.707107, -0.707107}], Point[{-0.707107, 0.707107, 0.707107}], Point[{0.707107, -0.707107, -0.707107}]}

Visualization of the intersection of the solid cylinders (blue) and the intersection of the boundary of the cylinders (red):

reg2 = RegionIntersection[
    Cylinder[{{0,0,-1},{0,0,1}}],
    Cylinder[{{0,-1,0},{0,1,0}}],
    Cylinder[{{-1,0,0},{1,0,0}}]
];

Show[Region @ reg2, mesh]

enter image description here

$\endgroup$
5
$\begingroup$

You can show the lines corresponding to intersection of pairs of three surfaces using the option BoundaryStyle. You can get the points where all three surfaces intersect using NSolve (as Michael suggested in comments) and use them with Graphics3D and put the two graphics together using Show:

ClearAll[x, y, z]
pnts = {x, y, z} /. NSolve[{x^2 + y^2 == 1, x^2 + z^2 == 1, y^2 + z^2 == 1}, {x, y, z}];

Show[ContourPlot3D[{x^2 + y^2 == 1, x^2 + z^2 == 1, y^2 + z^2 == 1}, 
  {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, 
  AxesLabel -> Automatic, 
  PlotLegends -> {Placed[SwatchLegend[ "Expressions"], Right], 
     Placed[LineLegend[{Orange, Purple, Cyan},
          {"intersection(1, 2)", "intersection(1, 3)", "intersection(2, 3)"}], Right], 
     Placed[PointLegend[{Red}, {"intersection(1, 2, 3)"}], Right]}, 
  Mesh -> None, 
  ContourStyle -> Opacity[.4], 
  BoundaryStyle -> {{1, 2} -> Directive[Orange, Thick], 
    {1, 3} -> Directive[Purple, Thick], 
    {2, 3} -> Directive[Cyan, Thick]}], 
  Graphics3D[{Red, Sphere[#, .2] & /@ pnts}]]

enter image description here

$\endgroup$
4
$\begingroup$
RegionPlot3D[
  x^2 + y^2 < 1 &&
  x^2 + z^2 < 1 &&
  y^2 + z^2 < 1,
 {x, -1.2, 1.2},
 {y, -1.2, 1.2},
 {z, -1.2, 1.2},
 PlotPoints -> 100,
 PlotStyle -> Opacity[0.5]]

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.