#ifndef LIBNOISE_H_ #define LIBNOISE_H_ enum { NOISE_PERLIN, NOISE_SIMPLEX, NOISE_WHITE, NOISE_BLUE }; struct noise_generator { int type; int seed; int perm[512]; }; double noise_simplex(int dim, double *vec); double noise_perlin(int dim, double *vec); double noise_gen(struct noise_generator *gen, int dim, double *vec); int noise_gen_vec(struct noise_generator *gen, int dim, double *vec, int npoints, double *result); double noise_fbm(struct noise_generator *gen, int dim, double *vec, double persistence); struct noise_generator *noise_gen_init(struct noise_generator *g, int type, int dim, int seed); /* * takes a start and end point and generates a noisy line between them * * line is constrained to be in a quadrilateral defined by the two end points * and two points equidistant from ... hmm, not sure how to specify dimensions * less than two don't make any sense. * * linevec is filled in with computed points */ int noise_line(struct noise_generator *gen, int dim, double *start, double *end, double width, int segments, double *linevec); /* * noise_polygon? * noise_patch? * noise_mesh? */ #endif