4

The code

n=30; (*number of points *)
points = RandomPoint[Sphere[],n]; (*points uniformly distributed on the unit sphere*)
p = ImplicitRegion[Table[points[[i]].{x,y,z}<=1,{i,1,n}],{x,y,z}]; (* intersection of corresponding half spaces *)
Region[p,PlotTheme->"Detailed"]

produces the following picture. It represents the intersection of 30 half spaces whose supporting hyperplanes are tangent to the sphere at random points. Intersection of 30 half spaces whose supporting hyperplanes are tangent to the sphere at random points

The edges of that polyhedron are messed up. Is there something I can do to get a better picture ?

3 Answers3

7

For a given j,We can use Hyperplane[points[[j]], points[[j]]] to represent the plane which tangent to the unit sphere at point points[[j]]. Then we use another n-1 HalfSpace to cut such plane and get one of such face.

n = 30;
points = RandomPoint[Sphere[], n];
faces = Table[
   RegionIntersection[Hyperplane[points[[j]], points[[j]]], 
    Sequence @@ 
     Table[HalfSpace[points[[i]], points[[i]]], {i, 
       Complement[Range[n], {j}]}]], {j, 1, n}];
DiscretizeRegion[#, MaxCellMeasure -> 10^-6] & /@ faces // Show

enter image description here

cvgmt
  • 72,231
  • 4
  • 75
  • 133
4

Region is a rather quick and dirty plotting routine. More elaborate is RegionPlot:

n = 30;

SeedRandom[1];
points = RandomPoint[Sphere[], n]; p = 
 ImplicitRegion[
  Table[points[[i]].{x, y, z} <= 1, {i, 1, n}], {x, y, z}];
d = 1.3;
RegionPlot3D[{x, y, z} \[Element] p, {x, -d, d}, {y, -d, d}, {z, -d, 
  d}, PlotPoints -> 20]

enter image description here

Daniel Huber
  • 51,463
  • 1
  • 23
  • 57
  • The PlotPoints->150 option improves the result though slowing down the execution. – user64494 May 17 '21 at 10:20
  • 1
    @user64494 - it is more efficient to use a combination of increasing both PlotPoints and MaxRecursion rather than depending solely on PlotPoints. For example, compare the results and timing for PlotPoints->100 versus PlotPoints -> 50, MaxRecursion -> 6 – Bob Hanlon May 17 '21 at 13:59
3

Using BoundaryDisctizeGraphics to discretize the HalfSpace first , then use RegionIntersection.

n = 30;
SeedRandom[1];
points = RandomPoint[Sphere[], n];
AbsoluteTiming[reg = BoundaryDiscretizeGraphics[HalfSpace[#, 1], PlotRange -> 2] & /@
  points // RegionIntersection]

enter image description here

Length[faces = MeshPrimitives[reg, 2]]

30

chyanog
  • 15,542
  • 3
  • 40
  • 78