Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/compare-angle
Compares two angles with a common edge
https://github.com/mikolalysenko/compare-angle
Last synced: 2 months ago
JSON representation
Compares two angles with a common edge
- Host: GitHub
- URL: https://github.com/mikolalysenko/compare-angle
- Owner: mikolalysenko
- License: mit
- Created: 2014-04-20T22:40:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-28T22:31:14.000Z (over 10 years ago)
- Last Synced: 2024-10-20T14:28:22.357Z (2 months ago)
- Language: JavaScript
- Size: 152 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
compare-angle
=============
Let A, B, C and D be four points in the plan. Then of the pair of angles ABC and ABD, determine which is larger.```
C
* D
\ *
\ABC/
\ / ABD
*-------------*
B A
```Example
=======```javascript
var compareAngle = require("compare-angle")var A = [2, 0]
var B = [0, 0]
var C = [-1, 2]
var D = [1, 1]console.log(compareAngle(A, B, C, D), compareAngle(A, B, D, C))
```Output:
```
1 -1
```Install
=======```
npm install compare-angle
```API
===#### `require("compare-angle")(a, b, c, d)`
Compares the angles ABC and ABD to determine which is greater.* `a`, `b` are the base points of the angle
* `c` is the end of the first angle
* `d` is the end of the second angle**Returns** A number indicating which angle is larger
* `+1` if angle ABC is greater than angle ABD
* `0` if the angles are equal
* `-1` if angle ABD is greater than angle ABCCredits
=======
(c) 2014 Mikola Lysenko. MIT License