()
| 67621 | } |
| 67622 | |
| 67623 | function _default() { |
| 67624 | var x0 = 0, |
| 67625 | y0 = 0, |
| 67626 | x1 = 1, |
| 67627 | y1 = 1, |
| 67628 | x = pointX, |
| 67629 | y = pointY, |
| 67630 | r, |
| 67631 | dx, |
| 67632 | dy; |
| 67633 | |
| 67634 | function hexbin(points) { |
| 67635 | var binsById = {}, |
| 67636 | bins = [], |
| 67637 | i, |
| 67638 | n = points.length; |
| 67639 | |
| 67640 | for (i = 0; i < n; ++i) { |
| 67641 | if (isNaN(px = +x.call(null, point = points[i], i, points)) || isNaN(py = +y.call(null, point, i, points))) continue; |
| 67642 | var point, |
| 67643 | px, |
| 67644 | py, |
| 67645 | pj = Math.round(py = py / dy), |
| 67646 | pi = Math.round(px = px / dx - (pj & 1) / 2), |
| 67647 | py1 = py - pj; |
| 67648 | |
| 67649 | if (Math.abs(py1) * 3 > 1) { |
| 67650 | var px1 = px - pi, |
| 67651 | pi2 = pi + (px < pi ? -1 : 1) / 2, |
| 67652 | pj2 = pj + (py < pj ? -1 : 1), |
| 67653 | px2 = px - pi2, |
| 67654 | py2 = py - pj2; |
| 67655 | if (px1 * px1 + py1 * py1 > px2 * px2 + py2 * py2) pi = pi2 + (pj & 1 ? 1 : -1) / 2, pj = pj2; |
| 67656 | } |
| 67657 | |
| 67658 | var id = pi + "-" + pj, |
| 67659 | bin = binsById[id]; |
| 67660 | if (bin) bin.push(point);else { |
| 67661 | bins.push(bin = binsById[id] = [point]); |
| 67662 | bin.x = (pi + (pj & 1) / 2) * dx; |
| 67663 | bin.y = pj * dy; |
| 67664 | } |
| 67665 | } |
| 67666 | |
| 67667 | return bins; |
| 67668 | } |
| 67669 | |
| 67670 | function hexagon(radius) { |
| 67671 | var x0 = 0, |
| 67672 | y0 = 0; |
| 67673 | return angles.map(function (angle) { |
| 67674 | var x1 = Math.sin(angle) * radius, |
| 67675 | y1 = -Math.cos(angle) * radius, |
| 67676 | dx = x1 - x0, |
| 67677 | dy = y1 - y0; |
| 67678 | x0 = x1, y0 = y1; |
| 67679 | return [dx, dy]; |
| 67680 | }); |
nothing calls this directly
no test coverage detected