diff options
author | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2004-05-17 18:12:38 (GMT) |
---|---|---|
committer | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2004-05-17 18:12:38 (GMT) |
commit | bace4ea18c03bfcaadab55300bc15290f87540c7 (patch) | |
tree | 48c9c670e4dde608d50fe68e00e783f18af8697b /pdf/splash/SplashMath.h | |
parent | ad63666daeeda50acc7630132d61fe044634fddd (diff) |
Initial revision
Diffstat (limited to 'pdf/splash/SplashMath.h')
-rw-r--r-- | pdf/splash/SplashMath.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/pdf/splash/SplashMath.h b/pdf/splash/SplashMath.h new file mode 100644 index 0000000..f1bde14 --- /dev/null +++ b/pdf/splash/SplashMath.h @@ -0,0 +1,46 @@ +//======================================================================== +// +// SplashMath.h +// +//======================================================================== + +#ifndef SPLASHMATH_H +#define SPLASHMATH_H + +#include <aconf.h> +#include <math.h> +#include "SplashTypes.h" + +static inline SplashCoord splashAbs(SplashCoord x) { + return fabs(x); +} + +static inline int splashFloor(SplashCoord x) { + return (int)floor(x); +} + +static inline int splashCeil(SplashCoord x) { + return (int)ceil(x); +} + +static inline int splashRound(SplashCoord x) { + return (int)floor(x + 0.5); +} + +static inline SplashCoord splashSqrt(SplashCoord x) { + return sqrt(x); +} + +static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) { + return pow(x, y); +} + +static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0, + SplashCoord x1, SplashCoord y1) { + SplashCoord dx, dy; + dx = x1 - x0; + dy = y1 - y0; + return sqrt(dx * dx + dy * dy); +} + +#endif |