nuclear@0: /* nuclear@0: libvmath - a vector math library nuclear@0: Copyright (C) 2004-2013 John Tsiombikas nuclear@0: nuclear@0: This program is free software: you can redistribute it and/or modify nuclear@0: it under the terms of the GNU Lesser General Public License as published nuclear@0: by the Free Software Foundation, either version 3 of the License, or nuclear@0: (at your option) any later version. nuclear@0: nuclear@0: This program is distributed in the hope that it will be useful, nuclear@0: but WITHOUT ANY WARRANTY; without even the implied warranty of nuclear@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nuclear@0: GNU Lesser General Public License for more details. nuclear@0: nuclear@0: You should have received a copy of the GNU Lesser General Public License nuclear@0: along with this program. If not, see . nuclear@0: */ nuclear@0: nuclear@0: #ifndef VMATH_H_ nuclear@0: #define VMATH_H_ nuclear@0: nuclear@0: #include nuclear@0: #include "vmath_types.h" nuclear@0: nuclear@0: #ifndef M_PI nuclear@0: #define M_PI PI nuclear@0: #endif nuclear@0: nuclear@0: #ifndef M_E nuclear@0: #define M_E 2.718281828459045 nuclear@0: #endif nuclear@0: nuclear@0: #define PI 3.141592653589793 nuclear@0: #define HALF_PI 1.570796326794897 nuclear@0: #define QUARTER_PI 0.785398163397448 nuclear@0: #define TWO_PI 6.283185307179586 nuclear@0: nuclear@0: nuclear@0: #define RAD_TO_DEG(a) ((((scalar_t)a) * 360.0) / TWO_PI) nuclear@0: #define DEG_TO_RAD(a) (((scalar_t)a) * (PI / 180.0)) nuclear@0: nuclear@0: #define SQ(x) ((x) * (x)) nuclear@0: nuclear@0: #define MIN(a, b) ((a) < (b) ? (a) : (b)) nuclear@0: #define MAX(a, b) ((a) > (b) ? (a) : (b)) nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: extern "C" { nuclear@0: #endif /* __cplusplus */ nuclear@0: nuclear@0: static inline scalar_t smoothstep(float a, float b, float x); nuclear@0: nuclear@0: static inline scalar_t frand(scalar_t range); nuclear@0: static inline vec3_t sphrand(scalar_t rad); nuclear@0: nuclear@0: scalar_t integral(scalar_t (*f)(scalar_t), scalar_t low, scalar_t high, int samples); nuclear@0: scalar_t gaussian(scalar_t x, scalar_t mean, scalar_t sdev); nuclear@0: nuclear@0: static inline scalar_t lerp(scalar_t a, scalar_t b, scalar_t t); nuclear@0: nuclear@0: scalar_t bspline(scalar_t a, scalar_t b, scalar_t c, scalar_t d, scalar_t t); nuclear@0: scalar_t spline(scalar_t a, scalar_t b, scalar_t c, scalar_t d, scalar_t t); nuclear@0: scalar_t bezier(scalar_t a, scalar_t b, scalar_t c, scalar_t d, scalar_t t); nuclear@0: nuclear@0: scalar_t noise1(scalar_t x); nuclear@0: scalar_t noise2(scalar_t x, scalar_t y); nuclear@0: scalar_t noise3(scalar_t x, scalar_t y, scalar_t z); nuclear@0: nuclear@0: scalar_t fbm1(scalar_t x, int octaves); nuclear@0: scalar_t fbm2(scalar_t x, scalar_t y, int octaves); nuclear@0: scalar_t fbm3(scalar_t x, scalar_t y, scalar_t z, int octaves); nuclear@0: nuclear@0: scalar_t turbulence1(scalar_t x, int octaves); nuclear@0: scalar_t turbulence2(scalar_t x, scalar_t y, int octaves); nuclear@0: scalar_t turbulence3(scalar_t x, scalar_t y, scalar_t z, int octaves); nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: } nuclear@0: #endif /* __cplusplus */ nuclear@0: nuclear@0: #include "vmath.inl" nuclear@0: nuclear@0: #include "vector.h" nuclear@0: #include "matrix.h" nuclear@0: #include "quat.h" nuclear@0: #include "ray.h" nuclear@0: nuclear@0: #endif /* VMATH_H_ */