0.0.1 • Published 6 years ago
cgeo-calc v0.0.1
cgeo-calc
Adds some computational geometry algorithms to cgeo.
This augments all geometry types (in a TypeScript-friendly way) with several methods.
The following treat coordinates as lying on a Cartesian plane, any projections are ignored. Degrees as input coordinates produce nonsensical output.
getSimpleArea()
, returns a number.getSimpleCentroid()
, returns acgeo.Point
.
Usage
import * as cgeo from 'cgeo';
import 'cgeo-calc';
import 'cgeo-wkt';
const line = new cgeo.LineString([{ x: 0, y: 0 }, { x: 1, y: 0 }, { x: 2, y: 0 }, { x: 2, y: 2 }]);
console.log(line.getSimpleCentroid().toWKT());
License
Copyright (c) 2017 BusFaster Ltd
0.0.1
6 years ago