/* This example uses the dp_irreg_isosurf function to produce an iso-valued * surface from data on an irregular 3D grid (in this case in spherical * polar coordinates). */ #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= { 30.0, 0.0, 0.0 }; static P_Point lookat= { 0.0, 0.0, 0.0 }; static P_Vector up= { 0.0, 0.0, 1.0 }; static float fovea= 45.0; static float hither= -10.0; static float yon= -60.0; /* Light source information */ static P_Point light_loc= {30.0, 0.0, 20.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 19 #define ISO_NY 20 #define ISO_NZ 21 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 r, theta, phi; for (i=0; i