5
$\begingroup$

Consider some region region, chosen for simplicity as a parallelepiped:

region= Parallelepiped[{0, 0, 0}, {{1, 0, 0}, {1, 1, 0}, {0, 1, 1}}]

Let us generate points that belong to this region:

pt = RandomPoint[
   Parallelepiped[{0, 0, 0}, {{1, 0, 0}, {1, 1, 0}, {0, 1, 1}}], 
   10000];
Show[BoundaryMeshRegion[region, 
  MeshCellStyle -> {1 -> Directive[Thick, Black], 
    2 -> Directive[Opacity[0.1], Interpreter["Color"]["aqua"]]}, 
  BoxRatios -> {1, 1, 1}, Boxed -> True, Axes -> True], 
 ListPointPlot3D[pt]]

Enter image description here

Next, let us assume the following task: suppose we have points that belong to some unknown region. Let us use the same points set pt for simplicity. In principle, we may visualize the region by using ListPointPlot3D. However, there is a problem: if the number of points is large, then this command is very slow and slows the interface down. Also, continuous figures look much prettier.

Is it possible, using pt, to visualize the region without using ListPointPlot3D, but instead somehow continuously, such that the result would look like the BoundaryMeshRegion plot? E.g., to "interpolate" the set of boundary points from pt in order to obtain a smooth function, and then just plot it?

$\endgroup$
1
  • 1
    $\begingroup$ Perhaps ConvexHullRegion is what you are looking for? $\endgroup$ Jun 24 at 15:07

4 Answers 4

5
$\begingroup$

I think you are after BoundingRegion:

br = BoundingRegion[pt, "MinConvexPolyhedron"];

Graphics3D[{
  Directive[Opacity[0.1], RGBColor[{0, 1, 1}]],
  br,
  Black, Opacity[0.3], Point[pt]
}]

3D polyhedral region and points

Above I am using your own definition of the list of points pt.

$\endgroup$
4
$\begingroup$

Another way will be to use alpha shapes. This is available as ConcaveHullMesh in MMA. Using your points pt we can get the following. I am setting the alpha parameter to 4 here.

Show[ConcaveHullMesh[pt, 4, Lighting -> {{"Directional", LightGreen, {{1., 0, 1.5}, {0, 0.5, 0}}}},BaseStyle -> Directive[Opacity[0.3], LightYellow]],
 ListPointPlot3D[pt, PlotStyle -> Blue], Boxed -> True, Axes -> True, AxesStyle -> Black]

enter image description here

$\endgroup$
4
$\begingroup$
  • Use GradientFittedMesh.
SeedRandom[1];
pt = RandomPoint[
   Parallelepiped[{0, 0, 0}, {{1, 0, 0}, {1, 1, 0}, {0, 1, 1}}], 
   10000];
reg = GradientFittedMesh[pt, PerformanceGoal -> "Speed", 
  VertexNormals -> Automatic, 
  MeshCellStyle -> {{2, All} -> Opacity[0.5, Brown], {1, All} -> 
     Opacity[0.5, Green]}]

enter image description here

  • 13.1 ReconstructionMesh.
ReconstructionMesh[pt,Method->{"AlphaShape","Alpha"->1}]

enter image description here

$\endgroup$
3
$\begingroup$

A possible solution using ConvexHullMesh:

chm = ConvexHullMesh[pt]
Length /@ {pt, MeshPrimitives[chm, 0]}

{10000, 122}

Graphics3D[{
  Directive[Opacity[0.2]]
  , Blend[{Cyan, Gray}]
  , chm
  , region
  , Blue, AbsolutePointSize[2]
  , Point@pt
  }
 ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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