Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

barycentric

mikolalysenko62.5kMIT1.0.1

Converts points to barycentric coordinates

simplex, triangle, tetrahedra, line, barycentric, coordinate, geometry

readme

barycentric

Computes the location of a point in a simplex in barycentric coordinates (aka areal coordinates).

Usage

Install using npm:

npm install barycentric

And then use as follows:

var barycentric = require("barycentric")

console.log(barycentric([[0,0], [0,1], [1,0]], [0.5, 0.5]))
//Prints:
//
//  [0, 0.5, 0.5]
//

Credits

(c) 2013 Mikola Lysenko. MIT License