Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
ppak_srface.c
Go to the documentation of this file.00001 #include "coxplot.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 void plotpak_srface( float * x , float * y , float * z ,
00020 int nx , int ny ,
00021 float theta , float phi )
00022 {
00023 integer * m ;
00024 float * xx , * yy ;
00025 integer mx , nnx , nny ;
00026 float s[6] , stereo=0.0 , zbot,ztop , rad , cth,sth,cph,sph ;
00027 int ii , nxy=nx*ny ;
00028
00029 if( nx <= 1 || ny <= 1 || z == NULL ) return ;
00030
00031 mx = nnx = (integer) nx ; nny = (integer) ny ;
00032
00033 zbot = ztop = z[0] ;
00034 for( ii=1 ; ii < nxy ; ii++ ){
00035 if( z[ii] < zbot ) zbot = z[ii] ;
00036 else if( z[ii] > ztop ) ztop = z[ii] ;
00037 }
00038
00039 xx = x ;
00040 if( xx == NULL ){
00041 xx = (float *) malloc( sizeof(float) * nx ) ;
00042 for( ii=0 ; ii < nx ; ii++ ) xx[ii] = ii ;
00043 }
00044
00045 yy = y ;
00046 if( yy == NULL ){
00047 yy = (float *) malloc( sizeof(float) * ny ) ;
00048 for( ii=0 ; ii < ny ; ii++ ) yy[ii] = ii ;
00049 }
00050
00051 s[3] = 0.5 * (xx[0] + xx[nx-1]) ;
00052 s[4] = 0.5 * (yy[0] + yy[ny-1]) ;
00053 s[5] = 0.5 * (zbot + ztop ) ;
00054
00055 rad = 100.0 * ( fabs(xx[nx-1]-xx[0]) + fabs(yy[ny-1]-yy[0]) + (ztop-zbot) ) ;
00056 cth = cos( theta * 3.1416/180.0 ) ; sth = sin( theta * 3.1416/180.0 ) ;
00057 cph = cos( phi * 3.1416/180.0 ) ; sph = sin( phi * 3.1416/180.0 ) ;
00058
00059 s[0] = s[3] + rad * sth * cph ;
00060 s[1] = s[4] + rad * sth * sph ;
00061 s[2] = s[5] + rad * cth ;
00062
00063 m = (integer *) malloc( sizeof(integer) * 2*nx*ny ) ;
00064
00065 srface_( xx , yy , z , m , &mx , &nnx , &nny , s , &stereo ) ;
00066
00067 free(m) ;
00068 if( yy != y ) free(yy) ;
00069 if( xx != x ) free(xx) ;
00070 return ;
00071 }