Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

is-opposed-angle

1.0.1 • Public • Published

is-opposed-angle

Greenkeeper badge Build Status Coverage Status

check if two angles are in opposite direction

Install

$ npm install --save is-opposed-angle

Usage

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

const isOpposedAngle = require('is-opposed-angle');
 
isOpposedAngle(0, Math.PI);
//=> true
 
// Use the options argument for degrees
isOpposedAngle(0, 540, {isDegree: true});
//=> true

API

isOpposedAngle(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 angle difference is not exactly opposite but within tolerance it is still considered opposed. Should be supplied in same unit as angle.

License

MIT © anoff

Install

npm i is-opposed-angle

DownloadsWeekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

4.06 kB

Total Files

4

Last publish

Collaborators

  • avatar