useful macros



I find I use these all the time.

uniform() - generate a random number on 0 - 1.0 minus epsilon
lerp() - linearly interpolate between a and b by t.
clamp() - force x to the range low to high.

Anyone got any more?

--
Basic Algorithms - a fantastic C resource
http://www.malcolmmclean.site11.com/www




.



Relevant Pages

  • Re: useful macros
    ... lerp- linearly interpolate between a and b by t. ... clamp() - force x to the range low to high. ... Basic Algorithms - a fantastic C resourcehttp://www.malcolmmclean.site11.com/www ...
    (comp.lang.c)
  • Re: New C operator -- would it be a good idea?
    ... min, max, PI, uniform, clamp, lerp and round should all ...
    (comp.lang.c)