Set of commonly required functions and functionalities relating to 2d geometry.
This module is going to contain common and uncommon functions and functionalities required in coordinate geometry, specifically for NodeJS and front-end javascript applications.
The repository is in its very nascent stage and open for contribution. In the absense of a proper repository for 2d geometry utilities, this project is highly needed. Connect @yuyudhan.
- Common functions and utilities in 2d geometry
- Support for polar (Radial) coordinates.
npm i node-coordinate-geometry --save
// Simple usaga
var ncg = require('node-coordinate-geometry');
var polygons = ncg.polygons;
console.log(polygons.pointInside([0, 0], [
[1, 1],
[-1, 1],
[-1, -1],
[1, -1],
]));
var ncg = require('node-coordinate-geometry');
var angles = ncg.angles;
var axes = ncg.axes;
var lines = ncg.lines;
var points = ncg.points;
var polygons = ncg.polygons;
More detailed documentation of each module can be found in the Detailed Documentation sectoin below.
Repository uses ChaiJS as assertion engine and mocha as test runner.
mocha --recursive specs/
The repository follows the following conventions on representations of different 2d geometry entities.
Angle is represented in radians throughout. Inter conversions from Sexagesimal, Centesimal and Circular Systems are available in angles routine.
Point is represented by a single dimensional array of length 2 as below.
[x,y]
Line segment is represented using an array of points as below.
[[x1, y1], [x2, y2]]
Polygon is represented by a set of points as below
[[x1, y1], [x2, y2], [x3, y3], ...., [xn, yn]]