is-same-angle

1.0.0 • Public • Published

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

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i is-same-angle

    Weekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4.08 kB

    Total Files

    4

    Last publish

    Collaborators

    • anoff