2
$\begingroup$

I am attempting to cut out holes in a sphere, circumscribed around a regular tetrahedron. To do so I define some points (p1 through p4 are the vertices of a tetrahedron)

p0 = {0, 0, 0};
p1 = a {0, 0, Sqrt[2/3] - 1/(2 Sqrt[6])};
p2 = a {-(1/(2 Sqrt[3])), -(1/2), -(1/(2 Sqrt[6]))};
p3 = a {-(1/(2 Sqrt[3])), 1/2, -(1/(2 Sqrt[6]))};
p4 = a {1/Sqrt[3], 0, -(1/(2 Sqrt[6]))};

Then I cimcumsribe a sphere around that:

S2 = Circumsphere[{p1, p2, p3, p4}];

Next, create a cylinder that goes from the center of the sphere (also the center of the "tetrahedron" to a vertex of the imaginary tetrahedron:

C1 = Cylinder[{p0, p1}, 5];

Take the RegionDifference (I.e. cut out the cylinder):

RD1 = RegionDifference[S2, C1];

And plot:

RegionPlot3D[RD1, PlotPoints -> 30, Axes -> True]

But this returns a blank graph!! Why?

[I know the theory should work because if instead of using a sphere I use an actual tetrahedron (and points in the center of each face) it works fine. (see code below)

a = 10 (*Edge Length*);

p1 = a {0, 0, Sqrt[2/3] - 1/(2 Sqrt[6])};
p2 = a {-(1/(2 Sqrt[3])), -(1/2), -(1/(2 Sqrt[6]))};
p3 = a {-(1/(2 Sqrt[3])), 1/2, -(1/(2 Sqrt[6]))};
p4 = a {1/Sqrt[3], 0, -(1/(2 Sqrt[6]))};

T1 = Tetrahedron[{p1, p2, p3, p4}];

h1 = (p1 + p2 + p3)/3;
hc = (p1 + p2 + p3 + p4)/4;

C1 = Cylinder[{h1, hc}, .5];

RD1 = RegionDifference[T1, C1];

RegionPlot3D[RD1, PlotPoints -> 20, Axes -> True, PlotRange -> All]

] Good Example

$\endgroup$
3
  • $\begingroup$ I can demonstrate more things that work/don't work if necessary, or explain further. I tried to hit the right balance of minimal code and full explanations above. $\endgroup$
    – andrewmh20
    May 29, 2015 at 2:12
  • $\begingroup$ You can get the Sphere from a Circumsphere by calling Simplify on it (for some reason Circumsphere documentation is online-only in 10.1 - maybe a bug). I think the problem rests with Cylinder. There seems to be a lot of illogical stuff and missing features like 3D Region intersections for meshes in Mathematica as well. $\endgroup$
    – Histograms
    May 29, 2015 at 2:50
  • $\begingroup$ @Histograms What should that change, even theoretically? In practice the problem persists. What makes you think the problem is with Cylinder? $\endgroup$
    – andrewmh20
    May 29, 2015 at 2:55

1 Answer 1

1
$\begingroup$

The problem lies with using Sphere (or Circumsphere), which are actually surfaces rather than solids. Instead use Ball:

a = 1;
p0 = {0, 0, 0};
p1 = a {0, 0, Sqrt[2/3] - 1/(2 Sqrt[6])};
p2 = a {-(1/(2 Sqrt[3])), -(1/2), -(1/(2 Sqrt[6]))};
p3 = a {-(1/(2 Sqrt[3])), 1/2, -(1/(2 Sqrt[6]))};
p4 = a {1/Sqrt[3], 0, -(1/(2 Sqrt[6]))};
cs = Circumsphere[{p1, p2, p3, p4}];
cyl = Cylinder[{p0, p1}, 0.05];
rd = RegionDifference[Ball[cs[[1]], cs[[2]]], cyl];
rd2 = RegionDifference[rd, Cylinder[{p0, p2}, 0.05]];
rp1 = RegionPlot3D[rd, Boxed -> False, Axes -> False, 
   Background -> Black, PlotStyle -> Opacity[0.5], PlotPoints -> 100]
rp2 = RegionPlot3D[rd2, Boxed -> False, Axes -> False, 
   Background -> Black, PlotStyle -> Opacity[0.5], PlotPoints -> 100]

enter image description here

$\endgroup$
6
  • $\begingroup$ What are you doing with "Ball"? It's not the smaller holes that makes it work, but the using Ball as the region. Why? $\endgroup$
    – andrewmh20
    May 29, 2015 at 3:07
  • $\begingroup$ @andrewmh20 I am taking centre and radius of circumsphere and then Ball generates the region (x-xc)^2+(y-yc)^2+(z-zc)^2<=r^2. $\endgroup$
    – ubpdqn
    May 29, 2015 at 3:09
  • $\begingroup$ But circumsphere is supposed to be usable as a region on it's own...Just like cylinder and tetrahedron. So why is ball necessary? (It also degrades the quality when compared to a pure sphere) $\endgroup$
    – andrewmh20
    May 29, 2015 at 3:10
  • $\begingroup$ @andrewmh20 I suggest you run the following: Volume[cs], RegionDimension[cs], RegionMeasure[cs] and 4 Pi cs[[2]]^2. You will notice the circumsphere is a surface and the measures and surface area coincide. Hence use of Ball $\endgroup$
    – ubpdqn
    May 29, 2015 at 3:15
  • 1
    $\begingroup$ That is the usual meaning of Sphere. It is also documented by "Sphere represents the shell {x | ||x - p|| = r}". $\endgroup$
    – ilian
    May 29, 2015 at 14:39

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.