is-opposed-angle
v1.0.1
Published
check if two angles are in opposite direction
Downloads
9
Maintainers
Readme
is-opposed-angle
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