coordinates
v0.1.6
Published
Calculate relative coordinates
Downloads
35
Maintainers
Readme
coordinates
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
- global-offset — element global offset
- is-pointer-inside — check if pointer is inside the element
- is-pointer-near — check if pointer is near the element
License
MIT