coordinates

0.1.6 • Public • Published

coordinates Build Status

Calculate relative coordinates

Install

npm install --save coordinates

Usage

import coordinates from 'coordinates';
 
coordinates({ x: 100, y: 100 }); // { x: 100, y: 100, r: 141.421, fi: 0.785 }
coordinates({ x: 50, y: 100 }, { x: 100, y: 100 }); // { x: -50, y: 0, r: 50, fi: 3.146 }

API

coordinates(point[, origin])

Return relative coordinates in Cartesian and polar coordinate systems.

point

Type: object

Point x, y coordinates.

origin

Type: object Default: { x: 0, y: 0 }

Origin x, y coordinates.

Related

License

MIT

Package Sidebar

Install

npm i coordinates

Weekly Downloads

8

Version

0.1.6

License

MIT

Last publish

Collaborators

  • andrepolischuk