gauss-shoelace
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

Gauss Shoelace

🎓 Wikipedia

This implementation of Gauss Shoelace algorythm to calculate polygonal area surface using points on the Cartesian plane.

Usage

First

npm install gauss-shoelace

Then

import gaussShoelace from 'gauss-shoelace';


/**
 * Hexagon figure like:
 *
 *  ##############
 *   #          #
 *    #        #
 *     #      #
 *    #        #
 *   #          #
 *  ##############
 *
 **/

const points: Array<[number, number]> = [
  [1, 1],
  [3, 4],
  [1, 7],
  [7, 7],
  [5, 4],
  [7, 1],
];

const S = gaussShoelace(points);

console.log(S) // 24

Package Sidebar

Install

npm i gauss-shoelace

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

2.45 kB

Total Files

4

Last publish

Collaborators

  • b12k