* Returns true if this Color equals other componentwise within the specified epsilon. * * @param {Color} other The Color to compare for equality. * @param {number} [epsilon=0.0] The epsilon to use for equality testing. * @returns {boolean} true if the Colors are
(other, epsilon)
| 576 | * @returns {boolean} <code>true</code> if the Colors are equal within the specified epsilon; otherwise, <code>false</code>. |
| 577 | */ |
| 578 | equalsEpsilon(other, epsilon) { |
| 579 | return ( |
| 580 | this === other || // |
| 581 | (defined(other) && // |
| 582 | Math.abs(this.red - other.red) <= epsilon && // |
| 583 | Math.abs(this.green - other.green) <= epsilon && // |
| 584 | Math.abs(this.blue - other.blue) <= epsilon && // |
| 585 | Math.abs(this.alpha - other.alpha) <= epsilon) |
| 586 | ); |
| 587 | } |
| 588 | |
| 589 | /** |
| 590 | * Creates a string representing this Color in the format '(red, green, blue, alpha)'. |
no test coverage detected