* @function HeatMap.prototype.rotate * @description 获取某像素坐标点 pixelP 绕中心 center 逆时针旋转 rotation 弧度后的像素点坐标。 * @param {number} pixelP - 像素坐标点位置。 * @param {number} rotation - 旋转角度。 * @param {number} center - 中心位置。
(pixelP, rotation, center)
| 353 | * @param {number} center - 中心位置。 |
| 354 | */ |
| 355 | rotate(pixelP, rotation, center) { |
| 356 | var x = Math.cos(rotation) * (pixelP[0] - center[0]) - Math.sin(rotation) * (pixelP[1] - center[1]) + center[0]; |
| 357 | var y = Math.sin(rotation) * (pixelP[0] - center[0]) + Math.cos(rotation) * (pixelP[1] - center[1]) + center[1]; |
| 358 | return [x, y]; |
| 359 | } |
| 360 | |
| 361 | /** |
| 362 | * @function HeatMap.prototype.scale |
no test coverage detected