/**
 * @see https://github.com/terifan/ImageResampler/blob/dbc212ce6aaa769bf3c9623cb6ead58ffd51d76c/src/org/terifan/image_resampler/FilterFactory.java#L348
 * @param {number} x
 * @returns {number}
 */
export function triangle(x) {
    if (x < -1) {
        return 0;
    }
    if (x < 0) {
        return 1 + x;
    }
    if (x < 1) {
        return 1 - x;
    }
    return 0;
}

triangle.support = 1;
