Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Cartesian to barycentric - Python

This python function converts cartesian coordinates to barycentric coordinates for any point belonging to a unit hypercube in dimension . The hypercube is defined as follows,

.

The function car2bar() takes the cartesian coordinates of any point within the hypercube expressed as a column vector. This function returns the barycentric coordinates linked to the vertices of . The weights of the barycentric coordinates are ordered based on the binary encoding of the vertex index. For example, the following code converts the cartesian coordinates car to the barycentric coordinates bar in dimension ,

>>> import numpy as np
>>> car = np.array([[0], [1]])
>>> bar = car2bar(car)
>>> print(bar)
[[0.]
 [1.]
 [0.]
 [0.]]

The vertices coordinates are obtained based on the binary decomposition of their respective indexes,

  • ,
  • ,
  • ,
  • .

The function can be used for a non unit hypercube by normalizing the cartesian coordinates between and .

About

Cartesian to barycentric coordinate conversion function written in python

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages