/* This example uses the dp_isosurface function to produce an iso-valued * surface from 3D gridded data. A bounding box shows the bounds of the * computational region. */ #include #include #include #include /* Macro to ease checking of error return codes */ #define ERRCHK( string ) if (!(string)) fprintf(stderr,"ERROR!\n") /* Camera information */ static P_Point lookfrom= { 1.0, 2.0, 17.0 }; static P_Point lookat= { 1.0, 2.0, -3.0 }; static P_Vector up= { 0.0, 1.0, 0.0 }; static float fovea= 45.0; static float hither= -5.0; static float yon= -30.0; /* Light source information */ static P_Point light_loc= {0.0, 1.0, 10.0}; static P_Color light_color= { P3D_RGB, 0.8, 0.8, 0.8, 0.3 }; static P_Color ambient_color= { P3D_RGB, 0.3, 0.3, 0.3, 0.8 }; /* Dimensions of the grid from which the isosurface is to be extracted */ #define ISO_NX 14 #define ISO_NY 15 #define ISO_NZ 16 static void calc_iso_data( float data[ISO_NX][ISO_NY][ISO_NZ] ) /* This function provides the values of which an iso-valued surface is * found. */ { int i, j, k; float x, y, z, phi, r, eps= 0.001; for (i=0; i