view doodle/tk/misc.d @ 29:960b408d3ac5

Builds and runs ok with builder now. Still heaps of cleaning up to do, especially code roughly imported from dog.
author Graham St Jack <graham.stjack@internode.on.net>
date Mon, 03 Aug 2009 23:19:55 +0930
parents 1754cb773d41
children 2b9329ed0f0e
line wrap: on
line source

module doodle.tk.misc;

double min(in double a, in double b) {
    return a < b ? a : b;
}

double max(in double a, in double b) {
    return a > b ? a : b;
}

double clamp(in double v, in double min, in double max) {
    assert(min < max);

    if (v < min) { return min; }
    else if (v > max) { return max; }
    else { return v; }
}