* is pt (r,a) inside polygon made up vertices at angles 'vangles' * inside a given polar sector * * @param {number} r : pt's radial coordinate * @param {number} a : pt's angular coordinate in *radians* * @param {2-item array} rBnds : sector's radial bounds * @param {2-item array} aBnds : secto
(r, a, rBnds, aBnds, vangles)
| 20 | * @return {boolean} |
| 21 | */ |
| 22 | function isPtInsidePolygon(r, a, rBnds, aBnds, vangles) { |
| 23 | if(!isAngleInsideSector(a, aBnds)) return false; |
| 24 | |
| 25 | var r0, r1; |
| 26 | |
| 27 | if(rBnds[0] < rBnds[1]) { |
| 28 | r0 = rBnds[0]; |
| 29 | r1 = rBnds[1]; |
| 30 | } else { |
| 31 | r0 = rBnds[1]; |
| 32 | r1 = rBnds[0]; |
| 33 | } |
| 34 | |
| 35 | var polygonIn = polygonTester(makePolygon(r0, aBnds[0], aBnds[1], vangles)); |
| 36 | var polygonOut = polygonTester(makePolygon(r1, aBnds[0], aBnds[1], vangles)); |
| 37 | var xy = [r * Math.cos(a), r * Math.sin(a)]; |
| 38 | return polygonOut.contains(xy) && !polygonIn.contains(xy); |
| 39 | } |
| 40 | |
| 41 | // find intersection of 'v0' <-> 'v1' edge with a ray at angle 'a' |
| 42 | // (i.e. a line that starts from the origin at angle 'a') |
nothing calls this directly
no test coverage detected
searching dependent graphs…