Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find the barycentric coordinates of a point
ResourceFunction["BarycentricCoordinates"][{p1,p2,…},q] finds the barycentric coordinates of point q in the coordinate system defined by the points pi. | |
ResourceFunction["BarycentricCoordinates"][{p1,p2,…},{q1,q2,…}] finds the barycentric coordinates for the points qi. |
Find the barycentric coordinates for the point {0.3,0.4} for the coordinate system {{1,1},{-1,1},{0,-1}}:
| In[1]:= | ![]() |
| Out[3]= |
Check the finding:
| In[4]:= |
| Out[4]= |
Exact input leads to exact output:
| In[5]:= |
| Out[5]= |
Calculate the values for multiple 2D points:
| In[6]:= |
| Out[6]= |
BarycentricCoordinates also works in higher dimensions:
| In[7]:= | ![]() |
| Out[7]= |
BarycentricCoordinates also works in very high dimensions:
| In[8]:= | ![]() |
| Out[11]= | ![]() |
Check that the barycentric coordinates add up to 1:
| In[12]:= |
| Out[12]= |
Recreate the point p and subtract it from the original:
| In[13]:= |
| Out[13]= | ![]() |
The barycentric coordinates add up to 1:
| In[14]:= | ![]() |
| Out[14]= |
The dimensions of the points must agree with each other:
| In[15]:= |
| Out[15]= |
The dimension of the coordinate system should be one more than the dimension of the points:
| In[16]:= |
| Out[16]= |
Interactively move the points of the coordinate system:
| In[17]:= | ![]() |
| Out[17]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License