This file implements the vector and noise routines needed to generate the different shapes that are being used for the shape mappings in SFA. The vector routines are basic. A vector is typedef-ed to an array of 3 floats. This makes it compatible with the OpenGL vectors.
The noise functions are taken from the book :
Texturing and modeling - a procedural approach
David Ebert et al, A P Professional, 1994.
#ifndef _VECTOR_NOISE_H #define _VECTOR_NOISE_H // // Vector.C : The vector routines // Part of my code for CMSC 698 // // Pradyut Panda # include# include # include # include # include typedef float Pvector[3] ; void vnormalize( Pvector v ); void vcross_product( Pvector v1 , Pvector v2, Pvector out ); void vminus( Pvector , Pvector , Pvector ); // ------------------------------------------------------------- /* noise.h : contains functions for noise , turbulence and fBm type functions */ # define NOISE_SIZE 64 # define TRUE 1 # define FALSE 0 typedef struct xyz_td { float x,y,z; } xyz_td; /* the noise functions */ float calc_noise( xyz_td pnt); float turbulence( xyz_td pnt , float pixel_size); double fBm( xyz_td , double , double , double ); # endif