$ cnpm install 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
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
npm install compare-angle
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 anglec is the end of the first angled is the end of the second angleReturns A number indicating which angle is larger
+1 if angle ABC is greater than angle ABD0 if the angles are equal-1 if angle ABD is greater than angle ABC(c) 2014 Mikola Lysenko. MIT License
Copyright 2013 - present © cnpmjs.org