* @function Pixel.prototype.distanceTo * @description 返回两个 pixel 的距离。 * @example * var pixcel = new Pixel(100,50); * var pixcel2 = new Pixel(110,30); * var distance = pixcel.distanceTo(pixcel2); * * @param {Pixel} px - 需要计算的 pixel。 * @returns {number} 作为参数传入的像素与当前像素点的距离。
(px)
| 99 | * @returns {number} 作为参数传入的像素与当前像素点的距离。 |
| 100 | */ |
| 101 | distanceTo(px) { |
| 102 | return Math.sqrt(Math.pow(this.x - px.x, 2) + Math.pow(this.y - px.y, 2)); |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * @function Pixel.prototype.add |
no outgoing calls
no test coverage detected