#include "ofMath.h" #include "ofAppRunner.h" #ifndef TARGET_WIN32 #include #endif //-------------------------------------------------- int ofNextPow2(int a){ // from nehe.gamedev.net lesson 43 int rval=1; while(rval max ? max : value; } // return sign of the number //-------------------------------------------------- int ofSign(float n) { if( n > 0 ) return 1; else if(n < 0) return -1; else return 0; } //-------------------------------------------------- bool ofInRange(float t, float min, float max) { return t>=min && t<=max; } //-------------------------------------------------- float ofRadToDeg(float radians) { return radians * RAD_TO_DEG; } //-------------------------------------------------- float ofDegToRad(float degrees) { return degrees * DEG_TO_RAD; } //-------------------------------------------------- float ofLerp(float start, float stop, float amt) { return start + (stop-start) * amt; } //-------------------------------------------------- float ofRandomWidth() { return ofRandom(0, ofGetWidth()); } //-------------------------------------------------- float ofRandomHeight() { return ofRandom(0, ofGetHeight()); }