Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Given a simplex and point, convert back and forth between areal and Cartesian coordinates
ResourceFunction["Areal"][simplex,point] converts point between Cartesian and areal coordinates based on simplex. |
Vertices of a 3-4-5 triangle give an example of a 2-simplex. We can convert back and forth:
In[1]:= | ![]() |
Out[1]= | ![]() |
In[2]:= | ![]() |
Out[2]= | ![]() |
Given a line segment or 1-simplex defined by two points some other points on the line can be calculated by areal coordinates:
In[3]:= | ![]() |
Out[3]= | ![]() |
Areal coordinates always have a sum of one:
In[4]:= | ![]() |
Out[4]= | ![]() |
The minimal sign of an areal coordinate determines if a point is inside, outside, or on the boundary of a given simplex:
In[5]:= | ![]() |
Out[7]= | ![]() |
By Pick’s theorem, interior + boundary/2 -1 = area, so this triangle should have area 12+6/2-1 = 14:
In[8]:= | ![]() |
Out[8]= | ![]() |
Some graphics primitives that correspond to simplices are also supported:
In[9]:= | ![]() |
Out[9]= | ![]() |
The following are equivalent:
In[10]:= | ![]() |
Out[10]= | ![]() |
In[11]:= | ![]() |
Out[11]= | ![]() |
In[12]:= | ![]() |
Out[12]= | ![]() |
The areal coordinates of the incenter are proportional to the sides of the triangle:
In[13]:= | ![]() |
Out[14]= | ![]() |
The trilinear coordinate formula of a triangle center can be used with areal coordinates to generate that center; here is a calculation of the orthocenter, where the altitudes of the triangle intersect:
In[15]:= | ![]() |
Out[20]= | ![]() |
A tetrahedron is an example of a 3-simplex. We can convert back and forth:
In[21]:= | ![]() |
Out[21]= | ![]() |
In[22]:= | ![]() |
Out[22]= | ![]() |
The areal coordinates correspond to the area/volume when the Cartesian point is substituted for a point of the simplex and divided by the original volume; if the point is outside of the simplex a negative value is returned:
In[23]:= | ![]() |
Out[23]= | ![]() |
The plane perpendicular to vector (1/3, 1/3, 1/3) has all totals equal to 1, so points on this plane are assumed to be areal coordinates and get converted to Cartesian coordinates. There exists a triangle where the areal and Cartesian coordinates are the same, but in general there is no back function for this special case:
In[24]:= | ![]() |
Out[24]= | ![]() |
Arrange 25 trees in 18 lines of 5 trees:
In[25]:= | ![]() |
Out[26]= | ![]() |
Arrange 149 points in 241 lines of 5:
In[27]:= | ![]() |
Out[28]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License