Function Repository Resource:

IntegerConvexHullMesh

Source Notebook

Generate the minimal mesh region with integer vertices that contains all points

Contributed by: Jon McLoone

ResourceFunction["IntegerConvexHullMesh"][pts]

generates the near-minimal integer mesh region containing points pts.

Details

ResourceFunction["IntegerConvexHullMesh"] works by expanding the ConvexHullMesh of the points to integer values and then progressively removing unneccessary corners.

Examples

Basic Examples (1) 

Find the region whose corners all lie on integer values that minimally contains a random set of points:

In[1]:=
pts = RandomReal[{-5, 5}, {20, 2}];
Show[ResourceFunction["IntegerConvexHullMesh"][pts], Graphics[Point[pts]], Axes -> True]
Out[2]=

Scope (2) 

Find the region whose corners all lie on integer values that minimally contains a random set of points in 3D:

In[3]:=
pts = RandomReal[{-5, 5}, {20, 3}];
Show[ResourceFunction["IntegerConvexHullMesh"][pts], Axes -> True]
Out[4]=

IntegerConvexHullMesh works trivially on points in a one-dimensional space:

In[5]:=
pts = {{0.5}, {1.5}};
Show[ResourceFunction["IntegerConvexHullMesh"][pts], Axes -> {True, False}, AxesOrigin -> {0, -1}]
Out[6]=

Publisher

Jon McLoone

Version History

  • 1.0.0 – 05 April 2022

License Information