]> pd.if.org Git - noise/blob - simplex.h
initial commit
[noise] / simplex.h
1 #ifndef LIBNOISE_H_
2 #define LIBNOISE_H_
3
4 enum {
5         NOISE_PERLIN, NOISE_SIMPLEX, NOISE_WHITE, NOISE_BLUE
6 };
7
8 struct noise_generator {
9         int type;
10         int seed;
11         int perm[512];
12 };
13
14 double noise_simplex(int dim, double *vec);
15 double noise_perlin(int dim, double *vec);
16 double noise_gen(struct noise_generator *gen, int dim, double *vec);
17 int noise_gen_vec(struct noise_generator *gen, int dim, double *vec, int npoints, double *result);
18 double noise_fbm(struct noise_generator *gen, int dim, double *vec, double persistence);
19
20 struct noise_generator *noise_gen_init(struct noise_generator *g, int type, int dim, int seed);
21
22 /*
23  * takes a start and end point and generates a noisy line between them
24  *
25  * line is constrained to be in a quadrilateral defined by the two end points
26  * and two points equidistant from ... hmm, not sure how to specify dimensions
27  * less than two don't make any sense.
28  *
29  * linevec is filled in with computed points
30  */
31
32 int noise_line(struct noise_generator *gen, int dim, double *start, double *end, double width, int segments, double *linevec);
33
34 /*
35  * noise_polygon?
36  * noise_patch?
37  * noise_mesh?
38  */
39
40 #endif