Mercurial > projects > doodle
annotate 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 |
rev | line source |
---|---|
29
960b408d3ac5
Builds and runs ok with builder now.
Graham St Jack <graham.stjack@internode.on.net>
parents:
28
diff
changeset
|
1 module doodle.tk.misc; |
0 | 2 |
26 | 3 double min(in double a, in double b) { |
0 | 4 return a < b ? a : b; |
5 } | |
6 | |
26 | 7 double max(in double a, in double b) { |
0 | 8 return a > b ? a : b; |
9 } | |
10 | |
26 | 11 double clamp(in double v, in double min, in double max) { |
0 | 12 assert(min < max); |
13 | |
14 if (v < min) { return min; } | |
15 else if (v > max) { return max; } | |
16 else { return v; } | |
17 } |