Function Repository Resource:

# BarycentricCoordinates

Find the barycentric coordinates of a point

Contributed by: Sander Huisman
 ResourceFunction["BarycentricCoordinates"][{p1,p2,…},p] finds the barycentric coordinates of point p in the coordinate system defined by the points pi.

## Details and Options

For a point in n dimensions, the first argument should be n+1 points.
ResourceFunction["BarycentricCoordinates"] gives the values λ1, λ2, …, λn such that and .
ResourceFunction["BarycentricCoordinates"] works in any dimension.

## Examples

### Basic Examples (2)

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]=

### Scope (4)

Exact input leads to exact output:

 In[5]:=
 Out[5]=

BarycentricCoordinates works in 1D:

 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]=

### Properties and Relations (1)

The barycentric coordinates add up to 1:

 In[14]:=
 Out[14]=

### Possible Issues (2)

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]=

### Neat Examples (1)

Interactively move the points of the coordinate system:

 In[17]:=
 Out[17]=

SHuisman

## Version History

• 1.0.0 – 23 September 2019