https://github.com/anoff/is-opposed-angle
check if two angles are in opposite direction
https://github.com/anoff/is-opposed-angle
angle check geometry nodejs radians
Last synced: 7 months ago
JSON representation
check if two angles are in opposite direction
- Host: GitHub
- URL: https://github.com/anoff/is-opposed-angle
- Owner: anoff
- License: mit
- Created: 2017-01-07T09:11:17.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T22:26:11.000Z (over 2 years ago)
- Last Synced: 2025-03-11T17:48:34.316Z (7 months ago)
- Topics: angle, check, geometry, nodejs, radians
- Language: JavaScript
- Size: 792 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# is-opposed-angle
[](https://www.npmjs.com/package/is-opposed-angle)
[](https://travis-ci.org/anoff/is-opposed-angle)
[](https://coveralls.io/github/anoff/is-opposed-angle?branch=master)
[](https://greenkeeper.io/)
[](https://snyk.io/test/npm/is-opposed-angle)
[](https://david-dm.org/anoff/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**.
```js
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](http://anoff.io)