angle-between-points

given two points, it returns the angle in degrees from one to the other

Usage no npm install needed!

<script type="module">
  import angleBetweenPoints from 'https://cdn.skypack.dev/angle-between-points';
</script>

README

angle-between-points

Given two points, it returns the angle in degrees from one to the other.

NPM

build status

EXAMPLE

angleBetweenPoints(point1, point2)

var angleBetweenPoints = require('angle-between-points');

angleBetweenPoints( {x: 1, y: 1}, {x: 4, y: 4} );
// returns 45

angleBetweenPoints( {x: 2, y: 2}, {x: -4, y: -4} );
// returns 225

angleBetweenPoints( {x: 2, y: 0}, {x: -4, y: 0} );
// returns 180

LICENSE

MIT