Function Repository Resource:

# ParameterizePolygon

Find the parameterization of a curve that linearly connects a list of points

Contributed by: Garrett Dubofsky, Wolfram|Alpha Math Team
 ResourceFunction["ParameterizePolygon"][{p1,p2,…},t] parameterizes the polygon defined by points pi with variable t from 0 to 1. ResourceFunction["ParameterizePolygon"][{{p11,p12,…},{p21,…},…},t] parameterizes the curve defined by a collection of polygons. ResourceFunction["ParameterizePolygon"][{p1,p2,…},{t,tmin,tmax}] creates a parameterization with variable t from tmin to tmax. ResourceFunction["ParameterizePolygon"][{p1,p2,…},{t0,tmin,tmax}] evaluates the parameterization with domain tmin to tmax at t0.

## Details

The collection of points pi can be in any dimension.
Points pi can be a combination of symbolic and numeric values.
The parameterization evaluates to {} for any inputs outside the domain.
The speed of the parameterization is consistent; the Euclidean distance between pairs of points is proportional to the domain allocated to the line connecting the points.
The following options are supported:
 "ClosedCurve" True whether to connect the first and last points "ExactValues" True the precision of the output "Orientation" Automatic the order used to evaluate the list of points

## Examples

### Basic Examples (2)

Parameterize the line from {0,1} to {1,1} over the domain[0,1]:

 In[1]:=
 Out[1]=

Parameterize the 3D polygon formed by three points:

 In[2]:=
 Out[2]=

Parameterize the same polygon over the domain[-3,3]:

 In[3]:=
 Out[3]=

Evaluate the above parameterization at t=-1/2:

 In[4]:=
 Out[4]=

### Scope (6)

Parameterize a collection of polygons:

 In[5]:=
 Out[5]=

Find the linear parameterization between a combination of numeric and symbolic points:

 In[6]:=
 Out[6]=

Parameterize a 1D curve:

 In[7]:=
 Out[7]=

Parameterize curves in 4 dimensions or greater:

 In[8]:=
 Out[8]=

The list of points can be substituted with Rectangle instead:

 In[9]:=
 Out[9]=

Substituting with Triangle is also supported:

 In[10]:=
 Out[10]=

Besides Triangle[], the heads Line, Triangle, and Polygon are ignored:

 In[11]:=
 Out[11]=

The resulting piecewise function can be input into ParametricPlot or ParametricPlot3D:

 In[12]:=
 Out[12]=
 In[13]:=
 Out[13]=

Pairs of adjacent points that are the same are treated as a single point:

 In[14]:=
 Out[14]=

### Options (3)

Determine if the list of points defines a closed curve:

 In[15]:=
 Out[15]=

Each polygon within a collection is automatically closed:

 In[16]:=
 Out[16]=

Setting "ExactValues" to False causes the output to be imprecise:

 In[17]:=
 Out[17]=

Determine the order of which the points are transversed using the "Orientation" option:

 In[18]:=
 Out[18]=
 In[19]:=
 Out[19]=

Curves formed using Rectangle are transversed clockwise by default:

 In[20]:=
 Out[20]=

The curve formed from Triangle[] is transversed counterclockwise by default:

 In[21]:=
 Out[21]=

### Applications (5)

Use the parameterization to analyze a function with 2D domain along a given curve:

 In[22]:=
 In[23]:=

Flatten out the 3D curve to see its output along the parameterization:

 In[24]:=
 Out[24]=

Superimpose the output along the parameterization atop the 3D function curve:

 In[25]:=
 In[26]:=
 In[27]:=
 Out[27]=

Visualize the output of a function with three variables along a 3D polygon:

 In[28]:=
 In[29]:=

Plot the polygon with Hue shading corresponding to the value of the function:

 In[30]:=
 Out[30]=

Plot the same function values as a timeline of the parameterization:

 In[31]:=
 Out[31]=

This process can be generalized to find the output of a 4 variable function along a 4D curve:

 In[32]:=
 In[33]:=
 In[34]:=
 Out[34]=

Higher-dimensional polygons can be visualized using Norm along their parameterization:

 In[35]:=
 Out[35]=

Linear functions can be generated using the plots of 1D polygons:

 In[36]:=
 Out[36]=

Regular polygons can be parameterized:

 In[37]:=
 Out[37]=

Other named curves can also be parameterized:

 In[38]:=
 Out[38]=

### Properties and Relations (1)

The resource function ColorWinding uses ParameterizePolygon internally and to generate the "PolygonPlot" output:

 In[39]:=
 Out[39]=

### Possible Issues (4)

Plotting functions are more efficient when the parameterization has inexact values:

 In[40]:=
 Out[40]=
 In[41]:=
 Out[41]=

Some polygons encounter a precision error that can be resolved by setting "ExactValues" to False:

 In[42]:=
 Out[42]=
 In[43]:=
 Out[43]=

Sometimes ParametricPlot will include a connecting line between multiple polygons:

 In[44]:=
 Out[44]=

Increasing the number of PlotPoints will remove extraneous points along the curve:

 In[45]:=
 Out[45]=

### Neat Examples (3)

Plot the parameterization of a cube:

 In[46]:=
 Out[46]=

Create abstract shapes using a single parameterization:

 In[47]:=
 Out[47]=

Applying a function along a 2D parameterization adds a new dimension to the shape:

 In[48]:=
 In[49]:=
 In[50]:=
 In[51]:=
 Out[51]=
 In[52]:=
 Out[52]=

Garrett Dubofsky

## Version History

• 1.0.0 – 29 August 2022

## Author Notes

The Piecewise function defaults to {} so that ParametricPlot and ParametricPlot3D do not encounter an error when evaluating the function outside the specified domain.

As seen in ParameterizePolygon[{{1},{2},{3}},t], each 1D point is surrounded by brackets to distinguish them from a higher-dimension point such as {1,2,3}.

To view the full source code for ParameterizePolygon, evaluate the following: