# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Make 2D and 3D graphics with specified polygons and corresponding textures

Contributed by:
Anton Antonov
| Anton Antonov

ResourceFunction["TexturizePolygons"][ makes a 2D or 3D plot for the list of polygons | |

ResourceFunction["TexturizePolygons"][ uses a random texture. |

ResourceFunction["TexturizePolygons"] takes all options of Graphics, Graphics3D and the resource function RandomMandala.

In addition to a list of polygons, the first argument to ResourceFunction["TexturizePolygons"] can also be a string name for an entity in PolyhedronData[].

If the second argument is an Association, then it is expected to map numbers of vertices to textures.

If the second argument is a list of 2D graphics, then those graphics are converted to textures.

In general, it is more aesthetically pleasing when polygons with the same number of vertices have the same textures.

The option "Granularity" can be used to control texture mapping.

If its value is "NumberOfVertices", then polygons with the same number of vertices have the same textures.

If its value is "Polygon", then each polygon has its own texture (according to the texture specification).

The option "VertexTextureCoordinatesFunction" is used to tune the assignment of texture coordinates to polygon vertices.

Here, polygons for a dodecahedron are given a random texture:

In[1]:= |

Out[2]= |

Here is the same texturized dodecahedron, unfolded:

In[3]:= |

Out[4]= |

The PolyhedronData properties "Net" and "Faces" can be used together with polyhedron names; 2D and 3D graphics are produced, respectively:

In[5]:= |

Out[5]= |

Apply TexturizePolygons over a list of random 2D polygons, translated and rotated for better comprehension:

In[6]:= |

Out[7]= |

Here is an example with 3D polygons:

In[8]:= |

Out[9]= |

The texture specifications Automatic and Random are shortcuts for generating textures using the resource function RandomMandala. Hence, all options of the resource function RandomMandala can be used:

In[10]:= |

Out[11]= |

In[12]:= |

Out[13]= |

The second argument can be a list textures or a list of 2D graphics to be used as textures:

In[14]:= |

Out[15]= |

In[16]:= |

Out[16]= |

In[17]:= |

Out[17]= |

The option "Granularity" can be used to control texture mapping. If its value is "NumberOfVertices" then polygons with the same number of vertices have the same textures. If its value is "Polygon" then each polygon it has its own texture according to the texture specification:

In[18]:= |

Out[18]= |

If the list of graphics for the textures is shorter than the specified list of polygons, the texture graphics list is extended by replicating and catenating:

In[19]:= |

Out[20]= |

In[21]:= |

Out[21]= |

The value of the option "VertexTextureCoordinatesFunction" is used to derive the value for VertexTextureCoordinates for each polygon. If the value of "VertexTextureCoordinatesFunction" is Automatic, then the following function is used:

In[22]:= |

Specialized assignment of the texture coordinates can be done:

In[23]:= |

In[24]:= |

Out[24]= |

Using the option Background can dramatically change the appearance:

In[25]:= |

Out[25]= |

Note that if the second argument is Automatic or Random, then the specified background is applied to both the total graphics background and the background of the automatically generated textures.

Place statistical plots on the walls of a polyhedron:

In[26]:= |

Out[29]= |

Note that in the example above, the number of walls corresponds to the number of rows of the data array; hence, "Granularity"→"Polygon" is used.

For certain data, it might be effective to show different statistical plots on different polyhedron walls:

In[30]:= |

Out[34]= |

If the second argument is Automatic and Random, then the resource function RandomMandala is used; hence, all options taken by that resource function can be specified:

In[35]:= |

Out[36]= |

A table of randomly chosen polyhedra with random mandala textures:

In[37]:= |

Out[38]= |

Textures over the walls of an unfolded polyhedron:

In[39]:= |

Out[40]= |

Textures using Chernoff face graphics via the resource function ChernoffFace:

In[41]:= |

Out[41]= |

Here are some random texturized polyhedra:

In[42]:= |

Out[42]= |

This work is licensed under a Creative Commons Attribution 4.0 International License