coordinates

Calculate relative coordinates

Usage no npm install needed!

<script type="module">
  import coordinates from 'https://cdn.skypack.dev/coordinates';
</script>

README

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