File: SplashMath.h

package info (click to toggle)
gpdf 2.8.2-1.2sarge6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,220 kB
  • ctags: 6,624
  • sloc: cpp: 61,071; ansic: 12,100; sh: 6,017; xml: 2,299; makefile: 589
file content (46 lines) | stat: -rw-r--r-- 955 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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