* 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)
| 55 | * @param {boolean} |
| 56 | */ |
| 57 | function 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? |
no test coverage detected
searching dependent graphs…