1.0.0 • Published 6 years ago

is-same-angle v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

is-same-angle

Greenkeeper badge Build Status Coverage Status

check if two angles are pointing in the same/similar direction

Install

$ npm install --save is-same-angle

Usage

Returns true if first and second argument are same angles. By default the angles must be passed in radian.

const isSameAngle = require('is-same-angle');

isSameAngle(0, 2 * Math.PI);
//=> true

// Use the options argument for degrees
isSameAngle(0, 360, {isDegree: true});
//=> true

API

isSameAngle(angle1, angle2, options) : Boolean

angle1 rad

Type: number

First angle by default it is assumed to be in radian format. See options for using other angle units.

angle2 rad

Type: number

Second angle by default it is assumed to be in radian format. See options for using other angle units.

options

isDegree

Type: boolean Default: false

Interpret the angle1 and angle2 values in degrees.

tolerance rad

Type: number Default: 0.1

If the angles are not exactly identical but within tolerance it is still considered same. Should be supplied in same unit as angle.

Related projects

License

MIT © anoff