Mercurial > projects > doodle
annotate doodle/tk/misc.d @ 44:2b9329ed0f0e
Added backtrace support
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Sun, 01 Aug 2010 02:06:14 +0930 |
parents | 960b408d3ac5 |
children |
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 |
44 | 3 // TODO move this to core |
4 | |
26 | 5 double min(in double a, in double b) { |
0 | 6 return a < b ? a : b; |
7 } | |
8 | |
26 | 9 double max(in double a, in double b) { |
0 | 10 return a > b ? a : b; |
11 } | |
12 | |
26 | 13 double clamp(in double v, in double min, in double max) { |
0 | 14 assert(min < max); |
15 | |
16 if (v < min) { return min; } | |
17 else if (v > max) { return max; } | |
18 else { return v; } | |
19 } |