Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Make a hole in the middle of a polygon
ResourceFunction["PerforatePolygons"][gr] creates a hole in the middle of each polygon in the 3D graphics gr. | |
ResourceFunction["PerforatePolygons"][gr,r] create a hole of size r, where r is the ratio of the hole size to the polygon size. | |
ResourceFunction["PerforatePolygons"][gr,"type"] decomposes into polygons of the specified "type" before creating holes. |
| "Simple" | simple polygons | |
| "Convex" | convex polygons | |
| "Triangle" | triangles |
A set of polygons:
| In[1]:= |
| Out[1]= | ![]() |
Random polygons:
| In[2]:= | ![]() |
| Out[2]= | ![]() |
A polyhedron:
| In[3]:= |
| Out[3]= | ![]() |
| In[4]:= |
| Out[4]= | ![]() |
Another polyhedron:
| In[5]:= |
| Out[5]= | ![]() |
Make smaller holes:
| In[6]:= |
| Out[6]= | ![]() |
With offsets:
| In[7]:= | ![]() |
| Out[7]= | ![]() |
With Scaled:
| In[8]:= |
| Out[8]= | ![]() |
With ImageScaled:
| In[9]:= |
| Out[9]= | ![]() |
A square with a hole with another square inside:
| In[10]:= | ![]() |
| Out[10]= | ![]() |
Sometimes different triangulations can be produced:
| In[11]:= | ![]() |
| Out[11]= | ![]() |
PolygonDecomposition can be used:
| In[12]:= | ![]() |
| Out[12]= | ![]() |
Starting with a polygon with holes:
| In[13]:= | ![]() |
| Out[13]= | ![]() |
Using entities:
| In[14]:= |
| Out[14]= | ![]() |
A Bohemian dome surface modifying the ratio of perforation:
| In[15]:= |
| In[16]:= | ![]() |
| Out[16]= | ![]() |
PerforatePolygons works with other primitives:
| In[17]:= |
| Out[17]= | ![]() |
Convert into a region:
| In[18]:= |
| Out[18]= | ![]() |
Using VertexTextureCoordinates:
| In[19]:= | ![]() |
| In[20]:= | ![]() |
| Out[20]= | ![]() |
With VertexColors:
| In[21]:= | ![]() |
| Out[21]= | ![]() |
Disconnected polyhedra:
| In[22]:= | ![]() |
| Out[22]= | ![]() |
A polyhedron with a void:
| In[23]:= | ![]() |
| Out[23]= | ![]() |
A non-convex polyhedron:
| In[24]:= |
| Out[24]= | ![]() |
A polyhedron with scaled coordinates:
| In[25]:= | ![]() |
| In[26]:= |
| Out[26]= | ![]() |
A polyhedron with VertexNormals:
| In[27]:= |
| In[28]:= | ![]() |
| Out[28]= | ![]() |
A holed hexagonal grid:
| In[29]:= | ![]() |
| In[30]:= | ![]() |
| Out[30]= | ![]() |
Perforate a prism:
| In[31]:= | ![]() |
| Out[31]= | ![]() |
Outline the prism:
| In[32]:= |
| Out[32]= | ![]() |
Convert polygons to tubes and vertices to spheres:
| In[33]:= |
| In[34]:= |
| Out[34]= | ![]() |
Nest perforations:
| In[35]:= | ![]() |
| Out[35]= | ![]() |
In 3D, if the vertices are not in a plane, the polygon triangulation can be unpredictable:
| In[36]:= |
| Out[36]= | ![]() |
Beethoven missing his ninth:
| In[37]:= |
| Out[37]= | ![]() |
A random winding polygon (this may take several minutes):
| In[38]:= |
| In[39]:= | ![]() |
| Out[40]= | ![]() |
Decomposing random polygons and perforating twice:
| In[41]:= | ![]() |
| Out[41]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License