MCPcopy Index your code
hub / github.com/plotly/plotly.js / isAngleInsideSector

Function isAngleInsideSector

src/lib/angles.js:57–78  ·  view source on GitHub ↗

* is angle inside sector? * * @param {number} a : angle to test in *radians* * @param {2-item array} aBnds : sector's angular bounds in *radians* * @param {boolean}

(a, aBnds)

Source from the content-addressed store, hash-verified

55 * @param {boolean}
56 */
57function isAngleInsideSector(a, aBnds) {
58 if(isFullCircle(aBnds)) return true;
59
60 var s0, s1;
61
62 if(aBnds[0] < aBnds[1]) {
63 s0 = aBnds[0];
64 s1 = aBnds[1];
65 } else {
66 s0 = aBnds[1];
67 s1 = aBnds[0];
68 }
69
70 s0 = mod(s0, twoPI);
71 s1 = mod(s1, twoPI);
72 if(s0 > s1) s1 += twoPI;
73
74 var a0 = mod(a, twoPI);
75 var a1 = a0 + twoPI;
76
77 return (a0 >= s0 && a0 <= s1) || (a1 >= s0 && a1 <= s1);
78}
79
80/**
81 * is pt (r,a) inside sector?

Callers 3

isPtInsideSectorFunction · 0.85
isPtInsidePolygonFunction · 0.85
isInsideFunction · 0.85

Calls 2

isFullCircleFunction · 0.85
modFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…