istereo2

diff libs/vmath/vmath.h @ 2:81d35769f546

added the tunnel effect source
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 19 Sep 2015 05:51:51 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/vmath/vmath.h	Sat Sep 19 05:51:51 2015 +0300
     1.3 @@ -0,0 +1,92 @@
     1.4 +/*
     1.5 +libvmath - a vector math library
     1.6 +Copyright (C) 2004-2011 John Tsiombikas <nuclear@member.fsf.org>
     1.7 +
     1.8 +This program is free software: you can redistribute it and/or modify
     1.9 +it under the terms of the GNU Lesser General Public License as published
    1.10 +by the Free Software Foundation, either version 3 of the License, or
    1.11 +(at your option) any later version.
    1.12 +
    1.13 +This program is distributed in the hope that it will be useful,
    1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 +GNU Lesser General Public License for more details.
    1.17 +
    1.18 +You should have received a copy of the GNU Lesser General Public License
    1.19 +along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.20 +*/
    1.21 +
    1.22 +#ifndef VMATH_H_
    1.23 +#define VMATH_H_
    1.24 +
    1.25 +#include <math.h>
    1.26 +#include "vmath_types.h"
    1.27 +
    1.28 +#ifndef M_PI
    1.29 +#define M_PI	PI
    1.30 +#endif
    1.31 +
    1.32 +#ifndef M_E
    1.33 +#define M_E				2.718281828459045
    1.34 +#endif
    1.35 +
    1.36 +#define PI				3.141592653589793
    1.37 +#define HALF_PI			1.570796326794897
    1.38 +#define QUARTER_PI		0.785398163397448
    1.39 +#define TWO_PI			6.283185307179586
    1.40 +
    1.41 +
    1.42 +#define RAD_TO_DEG(a) ((((scalar_t)a) * 360.0) / TWO_PI)
    1.43 +#define DEG_TO_RAD(a) (((scalar_t)a) * (PI / 180.0))
    1.44 +
    1.45 +#define SQ(x) ((x) * (x))
    1.46 +
    1.47 +#define MIN(a, b)	((a) < (b) ? (a) : (b))
    1.48 +#define MAX(a, b)	((a) > (b) ? (a) : (b))
    1.49 +
    1.50 +#ifndef __GNUC__
    1.51 +#define round(x)	((x) >= 0 ? (x) + 0.5 : (x) - 0.5)
    1.52 +#endif
    1.53 +
    1.54 +#ifdef __cplusplus
    1.55 +extern "C" {
    1.56 +#endif	/* __cplusplus */
    1.57 +
    1.58 +static inline scalar_t frand(scalar_t range);
    1.59 +static inline vec3_t sphrand(scalar_t rad);
    1.60 +
    1.61 +scalar_t integral(scalar_t (*f)(scalar_t), scalar_t low, scalar_t high, int samples);
    1.62 +scalar_t gaussian(scalar_t x, scalar_t mean, scalar_t sdev);
    1.63 +
    1.64 +static inline scalar_t lerp(scalar_t a, scalar_t b, scalar_t t);
    1.65 +
    1.66 +scalar_t bspline(scalar_t a, scalar_t b, scalar_t c, scalar_t d, scalar_t t);
    1.67 +scalar_t spline(scalar_t a, scalar_t b, scalar_t c, scalar_t d, scalar_t t);
    1.68 +scalar_t bezier(scalar_t a, scalar_t b, scalar_t c, scalar_t d, scalar_t t);
    1.69 +
    1.70 +scalar_t noise1(scalar_t x);
    1.71 +scalar_t noise2(scalar_t x, scalar_t y);
    1.72 +scalar_t noise3(scalar_t x, scalar_t y, scalar_t z);
    1.73 +
    1.74 +scalar_t fbm1(scalar_t x, int octaves);
    1.75 +scalar_t fbm2(scalar_t x, scalar_t y, int octaves);
    1.76 +scalar_t fbm3(scalar_t x, scalar_t y, scalar_t z, int octaves);
    1.77 +
    1.78 +scalar_t turbulence1(scalar_t x, int octaves);
    1.79 +scalar_t turbulence2(scalar_t x, scalar_t y, int octaves);
    1.80 +scalar_t turbulence3(scalar_t x, scalar_t y, scalar_t z, int octaves);
    1.81 +
    1.82 +#ifdef __cplusplus
    1.83 +}
    1.84 +#endif	/* __cplusplus */
    1.85 +
    1.86 +#include "vmath.inl"
    1.87 +
    1.88 +#include "vector.h"
    1.89 +#include "matrix.h"
    1.90 +#include "quat.h"
    1.91 +#include "sphvec.h"
    1.92 +#include "ray.h"
    1.93 +#include "geom.h"
    1.94 +
    1.95 +#endif	/* VMATH_H_ */