Function Repository Resource:

SymbolToPolygon

Source Notebook

Return a polygon, given a symbol

Contributed by: Ed Pegg Jr

ResourceFunction["SymbolToPolygon"][symbol,dimension]

returns symbol as a polygon with vertices in dimension.

Details

The value of dimension can be "2D" or "3D" (the default).
The first argument can also be a String.

Examples

Basic Examples (2) 

Label the sides of a cube:

In[1]:=
tab = {{0, {0, 1, 0}}, {Pi/2, {0, 1, 0}}, {Pi/2, {1, 0, 0}}, {-Pi/
     2, {1, 0, 0}}, {-Pi/2, {0, 1, 0}}, {Pi, {0, 1, 0}} };
Graphics3D[
 Table[Polygon[
   ResourceFunction["SymbolToPolygon"][ToString[n]][[1]] . RotationMatrix[tab[[n, 1]],
     tab[[n, 2]]]], {n, 1, 6}]]
Out[2]=

Return a 2D polygon for 42:

In[3]:=
Graphics[{EdgeForm[Black], Red, ResourceFunction["SymbolToPolygon"]["42", "2D"]}]
Out[3]=

Scope (1) 

Different styles and fonts can be used:

In[4]:=
Graphics3D[
 ResourceFunction["SymbolToPolygon"][
  Style["8", FontFamily -> "Times", Italic]]]
Out[4]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Version History

  • 2.0.0 – 23 November 2021
  • 1.0.0 – 26 February 2019

Related Resources

License Information