Пример #1
0
static void arrow(float x1, float y1, float x2, float y2)
{
    float dx, dy, r, backx, backy, perpx, perpy, tipx, tipy;
    dx = x2 - x1;
    dy = y2 - y1;
    r = hypotf(dx,dy);
    if ( r < .5)  r = .5;

    backx = -.15 * dx / r;
    backy = -.15 * dy / r;
    perpx =  .05 * dy / r;
    perpy = -.05 * dx / r;
    vp_umove( x1, y1 );         
    vp_udraw( x2, y2 );

    tipx = x2 + backx + perpx;
    tipy = y2 + backy + perpy;
    vp_umove( x2, y2 );         
    vp_udraw( tipx, tipy);

    tipx = x2 + backx - perpx;
    tipy = y2 + backy - perpy;
    vp_umove( x2, y2 );         
    vp_udraw( tipx, tipy);
}
Пример #2
0
void vp_plotframe(int col)
{
    vp_color(col);
    vp_umove(min1, min2);
    vp_udraw(min1, max2);
    vp_udraw(max1, max2);
    vp_udraw(max1, min2);
    vp_udraw(min1, min2);
}
Пример #3
0
static void plotaxis(struct Axis *axis)
{
    vp_fat(axisfat);
    if (axis == &axis1) {
	vp_umove(min1, axis->or);
	vp_udraw(max1, axis->or);
    } else {
	vp_umove(axis->or, min2);
	vp_udraw(axis->or, max2);
    }
} 
Пример #4
0
static void draw_rays (struct heptagon *cube, int nr)
{
    int ii;
    float dp[1], gp[1];

    dp[0] = 0.01; gp[0] = 0.008;

    vp_setdash(dp, gp, 0);
    vp_fat(SKINNY);
    vp_color(VP_RED);
    vp_umove(cube[0].x0.x, cube[0].x0.z);
    vp_udraw(cube[0].x1.x, cube[0].x1.z);
    for(ii=1;ii<nr;ii++) {
	if(cube[ii].cf==END && cube[ii-1].cf==END) continue;
	vp_umove(cube[ii].x0.x, cube[ii].x0.z);
	vp_udraw(cube[ii].x1.x, cube[ii].x1.z);
    }
    return;
}
Пример #5
0
static void draw (vp_contour cnt, bool mask, float x, float y) 
{
    float x2, y2;

    x2 = cnt->o1+(x+y*cnt->s1)*cnt->d1;
    y2 = cnt->o2+(y+x*cnt->s2)*cnt->d2;

    if (cnt->transp) {    
	if (mask) {
	    vp_udraw (y2,x2);
	} else {
	    vp_umove (y2,x2);
	}
    } else {
	if (mask) {
	    vp_udraw (x2,y2);
	} else {
	    vp_umove (x2,y2);
	}
    }
}
Пример #6
0
int main(void)
{
    int ix,nx=100, iz, nz=100, degrees=85;
    float dx, xmin=-4., xmax=7., tmax=9., x,t, x0;
    float alfa, c2a, orig, arg;

    vp_init();

    x0= xmin;
    dx= (xmax-xmin)/(nx-1);
    vp_uorig( -1.+xmin, 0.);

    vp_utext(  xmin/2, tmax+.45, 18, 0, "Common Shot");
    vp_utext( xmax+.1, tmax-.45, 14, 0, "g");
    vp_utext( .25     ,  .1    , 14, 0, "t");

    vp_uclip (xmin, .6, xmax, tmax);
    vp_umove( xmin, tmax); 	
    vp_udraw( xmax, tmax);
    vp_umove(   0., tmax); 	
    vp_udraw( 0., tmax-tmax);
    vp_color(6);
    for (iz=0; iz < nz; iz++) {
	orig = 3 * ((xmax-xmin) * rand01() +xmin);
	alfa = degrees *  2 * 3.14 / 360 * rand01(); 
	c2a = cos( 2*alfa);
	vp_penup();
	for (ix=0; ix < nx; ix++) {			/* x=g; s=0 */
	    x = x0 + ix*dx;
	    arg = orig*orig +(x-orig)*(x-orig) + 2*orig*(x-orig) * c2a;
	    t = sqrtf( arg); 
	    if( t < fabsf(x)) t = fabsf(x);
	    vp_upendn(x, tmax-t);
	}
    }

    return 0;
}
Пример #7
0
static void doit(float wide, int job)
{
    float v, t,z, x,H, tmax=8., zbot,dx=.04;
    int	labelsize=12, iz;

    H=9.;			/* height of top of frame */

    v= 1.3 * wide/tmax;

    vp_fat ( 6);
    vp_umove (-wide,H-0.); 	
    vp_udraw (wide,H-0);
    vp_umove (0,H-0.);		
    vp_udraw (0.,H-tmax);

    vp_fat ( 3);
    vp_utext( wide-.3, H-       0.4, labelsize, 0, "x");	
    if (job == 1) {
	vp_utext(     0.15,H- tmax+.03 , labelsize, 0, "t");	
    } else {
	vp_utext(     0.15,H- tmax+.03 , labelsize, 0, "t+z/v");
    }

    for (iz=1; iz <= 3; iz++) {
	z   = .2*iz*tmax;
	zbot= .2* 3*tmax;
	vp_penup ();
	for( x=-wide+dx/2.; x<wide; x += dx) {
	    t = hypotf(z,x/v);
	    if( t < sqrtf(2.)*z) {
		if( job == 2) t += zbot-z;
		vp_upendn (x, H-t);
	    }
	}
    }
}
Пример #8
0
static void draw_wavefronts (struct heptagon *cube, int nr, float DSmax)
{
    int ii;
    float dp[1], gp[1];
    
    dp[0] = 0.01; gp[0] = 0.008;

    vp_fat(SKINNY);
    vp_color(VP_GREEN);        
    vp_setdash(dp, gp, 0);
    for(ii=0;ii<nr;ii++) {
	if(cube[ii].cf==END) continue;
        vp_umove(cube[ii].x1.x, cube[ii].x1.z);
        vp_udraw(cube[(ii+1+nr)%nr].x1.x, cube[(ii+1+nr)%nr].x1.z);
    }   
    return;
}
Пример #9
0
int main(int argc, char* argv[])
{
    const int nt=300, nx=64, nz=300, nb=50; 
    int it, ib, iz, ix;
    float v=1.,t,z,x,x0, theta, *b, **tdat, **zdat;
    float top=3.2, c1=.9, c2=6.8, d1=0.02, d2=0.12, r;
    sf_file c, d;

    sf_init(argc,argv);
    
    b = sf_floatalloc(nb);
    tdat = sf_floatalloc2(nt,nx);
    zdat = sf_floatalloc2(nz,nx);

    if (!sf_getfloat("top",&top)) top=5.;
    if (!sf_getfloat("c1",&c1)) c1=0.5;
    if (!sf_getfloat("c2",&c2)) c2=5.;

    vp_init();

    vp_uorig (-c1,-.5);
    vp_uclip (0.,top-3.,4.,top);
    vp_umove (0.,top-0.);  
    vp_udraw (0.,top-4.);
    vp_umove (0.,top-0.);  
    vp_udraw (4.,top-0.);

    for (z=.4; z < 4.; z += .4) {
	vp_penup ();
	x0 = z * tanf( SF_PI*45./180.);
	for (x=0.; x < 4.; x += .01) {
	    t = hypotf(z,x-x0)/v;
	    vp_upendn (x,top-t);
	}
    }

    	
    for (ib=0; ib < nb; ib++) {
	b[ib] = expf(-3.*(ib+1.)/20.) * sinf(SF_PI*(ib+1.)/10.);
    }
    
    if (NULL != sf_getstring("c")) {
	c = sf_output("c");
	sf_setformat(c,"native_float");
	sf_putint(c,"n1",nt);
	sf_putint(c,"n2",nx);
	sf_putfloat(c,"d1",d1);
	sf_putfloat(c,"d2",d2);
	
	for (ix=0; ix < nx; ix++) {
	    for (it=0; it < nt; it++) {
		tdat[ix][it] = 0.;
	    }
	}
	
	for (iz=0; iz < 12; iz++) {
	    z = (iz+1.)*nt/12.;
	    x0 = z * tanf( SF_PI*45./180.);
	    for (ix=0; ix < nx; ix++) {
		x = (ix+1.) * d2/d1;
		t = hypotf(z,x-x0)/v;
		for (ib=0; ib < nb; ib++) {
		    it = t+ib-1;
		    if (it < nt) tdat[ix][it] += b[ib];
		}
	    }
	}

	sf_floatwrite(tdat[0],nt*nx,c);
    }

    vp_uorig (-c2,-.5);
    vp_uclip (0.,top-3.,4.,top);
    vp_umove (0.,top-0.);  
    vp_udraw (0.,top-4.);
    vp_umove (0.,top-0.);   
    vp_udraw (4.,top-0.);

    for(t=.4; t<6.; t += .4) {
	vp_penup ();
	x0 = t / sinf( SF_PI*45./180.);
	for (theta=-89.5; theta<89.5; theta += 1.) {
	    z =      t * cosf (SF_PI*theta/180.);
	    x = x0 + t * sinf (SF_PI*theta/180.);
	    vp_upendn (x,top-z);
	}
    }

    if (NULL != sf_getstring("d")) {
	d = sf_output("d");
	sf_setformat(d,"native_float");
	sf_putint(d,"n1",nz);
	sf_putint(d,"n2",nx);
	sf_putfloat(d,"d1",d1);
	sf_putfloat(d,"d1",d2);
	
	for (ix=0; ix < nx; ix++) {
	    for (iz=0; iz < nz; iz++) {
	    zdat[ix][iz] = 0.;
	    }
	}
	
	for (it=0; it < 20; it++) {
	    t = (it+1.)*nz/20.;
	    x0 = t / sinf( SF_PI*45./180.);
	    for (theta=-89.5; theta<89.5; theta += 1.) {
		z =      t * cosf (SF_PI*theta/180.);
		x = x0 + t * sinf (SF_PI*theta/180.);
		ix = x * d1/d2;
		r = hypotf(z,x-x0);
		for (ib=0; ib < nb; ib++) {
		    iz = z + ib-1;
		    if (iz >= 0 && iz < nz && ix >=0 && ix < nx)
			zdat[ix][iz] += b[ib]*r;
		}
	    }
	}
	
	sf_floatwrite(zdat[0],nz*nx,d);
    }

    exit(0);
}
Пример #10
0
int main(void)
{
    bool wantframe=false;
    float xll=1.705,yll=1.37,xur=11.945,yur=8.87,theta3=20.;
    float sn[3],cs[3],vv[3]={1.5,2.0,2.5},dz[3]={1.0,2.0,1.5};
    float zbottom, h, t, x, z, x1,z1, xtxt, ztxt;
    float xmin, zmin, xmax, zmax, xscale, zscale;
    int i, plotcol=6,plotfat=1;

    vp_init();

/* precompute quantities related to vplot scales */
    zbottom = 0.;
    for (i = 0; i < 3; i++) {
	zbottom += dz[i];
    }
    theta3 *= acosf(-1.)/180.;
    sn[2]=sinf(theta3);

    h=0.; 
    t=0.;
    for (i=2; i >= 0; i--) {
	if (i != 2)  sn[i] = sn[i+1]*vv[i]/vv[i+1]; /* snell's law */
	cs[i] = sqrtf(1. - sn[i]*sn[i]);
	h += dz[i]*sn[i]/cs[i];
	t += 2*dz[i]/(cs[i]*vv[i]);
    }

    xmin = -h - 0.1*zbottom; if (xmin > -2.) xmin=-2.;
    zmin = -0.1 * zbottom;
    xmax = -xmin;
    zmax = 1.1*zbottom; if (zmax < 3.) zmax=3.;

/* set vplot scales */
    vp_orig(xll,yur);
    vp_uorig(xmin,zmin);
    xscale = (xur-xll)/(xmax-xmin);
    zscale = -(yur-yll)/(zmax-zmin);
    vp_scale(xscale,zscale);

/* draw flat reflectors */
    vp_color(plotcol);
    vp_fat(plotfat);

    z=0.;
    for (i=0; i < 3; i++) {
	z += dz[i];
	vp_umove(xmin,z);
	vp_udraw(xmax,z);
    }

/* draw vertical zero-offset ray */
    vp_color(7);
    vp_umove(0.,0.);
    vp_udraw(0.,zbottom);

/* draw ray paths from bottom reflector to geophone */
    vp_color(2);

    x=0; 
    z=zbottom;
    for (i=2; i >= 0; i--) {	
	if (i != 0) {
	    vp_umove(x,z);
	    x += dz[i]*sn[i]/cs[i];
	    z -= dz[i];
	    vp_udraw(x,z);
	} else  {
	    x1 = x; 
	    z1 = z; 
	    x += dz[i]*sn[i]/cs[i];
	    z -= dz[i]; 
	    vp_uarrow(x1,z1,x,z,0.02*zbottom);
	}  
    }

/* draw ray paths from source to bottom reflector */
    vp_color(2);
    x=0; 
    z=zbottom;
    for (i=2; i >= 0; i--) {
	if (i != 2) {
	    vp_umove(x,z);
	    x -= dz[i]*sn[i]/cs[i];
	    z -= dz[i];
	    vp_udraw(x,z);
	} else  {
	    x1 = x; 
	    z1 = z; 
	    x -= dz[i]*sn[i]/cs[i];
	    z -= dz[i]; 
	    vp_uarrow(x,z,x1,z1,0.02*zbottom);
	}  
    }

/* draw surface */
    vp_color(7);
    vp_fat(2*plotfat);
    vp_umove(xmin,0.);
    vp_udraw(xmax,0.);

/* draw text */
    vp_color(5);
    vp_fat(plotfat);
    vp_tjust(2,3);

    x = 0.;
    z = zbottom * 1.05;
    vp_utext(x,z,8,0,"R");

    x = -h;
    z = 0.- zbottom *.05;
    vp_utext(x,z,8,0,"S");

    x = h;
    z = 0. - zbottom *.05;
    vp_utext(x,z,8,0,"G");

    x = -h;
    z = 0. + dz[0]/2.;
    vp_utext(x,z,8,0,"v\\s60 \\_1");

    z += dz[0]/2. + dz[1]/2.;
    vp_utext(x,z,8,0,"v\\s60 \\_2");

    z += dz[1]/2. + dz[2]/2.;
    vp_utext(x,z,8,0,"v\\s60 \\_3");

    x = 0.;
    z = 0. - zbottom *.05;
    vp_utext(x,z,8,0,"2h");
    x = 0. + 0.05*zbottom;
    vp_umove(x,z);
    x1 = h - 0.05 * zbottom;
    vp_uarrow(x,z,x1,z,-0.02*zbottom);
    x = 0. - 0.05*zbottom;
    vp_umove(x,z);
    x1 = -h + 0.05 * zbottom;
    vp_uarrow(x,z,x1,z,-0.02*zbottom);
	
/*						Highlight the trigonometry */
    vp_color(7);
    vp_fat(plotfat);
/*						bottom of triangle */
    z=zbottom-dz[2];
    x=dz[2]*sn[2]/cs[2];
    vp_umove(x,z);
    x1 = x + dz[1]*sn[1]/cs[1];
    z1 = z;
    vp_udraw(x1,z1);
    xtxt = (x+x1)/2.;
    ztxt = z + 0.05 * zbottom;
    vp_utext(xtxt,ztxt,8,0,"\\F9 D\\F3 x\\_\\s60 i");

/*						vertical side of triangle */
    x = x1;
    z = z1 - dz[1];
    vp_umove(x1,z1);
    vp_udraw(x,z);
    xtxt = x + 0.05 * zbottom;
    ztxt = (z+z1)/2.;
    vp_utext(xtxt,ztxt,8,0,"\\F9 D\\F3 z\\_\\s60 i");
    xtxt = x - sn[1]/cs[1]*dz[1]/8.;
    ztxt = z + dz[1]/4.;
    vp_utext(xtxt,ztxt,8,0,"\\F9 q\\F3 \\s60 \\_i");

/*						vertical side in tau space */
    xtxt = 0. - 0.05*zbottom;
    ztxt = z + dz[1]/2.;
    vp_utext(xtxt,ztxt,8,90,
	     "\\F9 Dt\\F3 \\s60 \\_i\\^\\s100 v\\s60 \\_i\\^\\s100 /2");

/*						hypotenuse of triangle */
    z1=zbottom-dz[2];
    x1=dz[2]*sn[2]/cs[2];
    vp_umove(x,z);
    vp_udraw(x1,z1);
    xtxt = (x+x1)/2. - 0.05 *zbottom;
    ztxt = (z+z1)/2.;
    vp_utext(xtxt,ztxt,8,60,
	     "\\F9 D\\F3 t\\s60 \\_i\\^\\s100 v\\s60 \\_i\\^\\s100 /2");

/* draw a frame */

    if(wantframe) {
	vp_color(7);
	vp_fat(1);
	vp_umove(xmin,zmin);
	vp_udraw(xmin,zmax);
	vp_udraw(xmax,zmax);
	vp_udraw(xmax,zmin);
	vp_udraw(xmin,zmin);
    }
	   
    exit(0);
}
Пример #11
0
int main (void)
{
    float xval[NARRAY], zval[NARRAY];
    int plotfat=1, ith, iflag, emph;
    bool wantframe=false,option=true,animate=false;
    float xll=1.705,yll=1.37,xur=11.945,yur=8.87;
    float h=1.0,y=0.0,time=1.6,v=2.0,theta=30., xstart, zstart;
    float a, b, xs, xg, surface,slop,xmin,zmin,xmax,zmax;
    float xscale, zscale, dth, thtmp, xsp;
    float tanth, sinth, costh, d, xr, zr, x,z, x1,z1, xend,zend;

    vp_init();

    /*				set parameters */
    a = v * time /2.;
    b = sqrtf(a*a-h*h);
    xs = y - h;
    xg = y + h;
    surface = 0.;

    slop = 0.05*a;
    xmin = -2.;
    zmin = -1.;
    xmax =  2.;
    zmax = 2.;

    /* set vplot scales */
    vp_orig(xll,yur);
    vp_uorig(xmin,zmin);
    xscale = (xur-xll)/(xmax-xmin);
    zscale = -(yur-yll)/(zmax-zmin);
    vp_scale(xscale,zscale);

/* 					draw and annotate surface */
    vp_fat(2*plotfat);

    vp_color(7);   
    vp_umove(xmin,surface);
    vp_udraw(xmax,surface);

    vp_color(5);
    vp_fat(plotfat);
    vp_tjust(4,6);
    vp_utext(xs-0.5*slop,surface-slop,8,0,"S");
    vp_utext(xg,surface-slop,8,0,"G");
    vp_utext(y,surface-slop,8,0,"M");

    dth = 180./(NARRAY-1);

    vp_color(4);
    /* LOOP on theta (ith) to generate ellipse */
    for (ith = 0; ith < NARRAY; ith++) {
	thtmp = 90. - ith * dth;
        thtmp = thtmp*SF_PI/180.;
        tanth = tanf(thtmp);
        sinth = sinf(thtmp);
	costh = cosf(thtmp);

	d = hypotf(a*sinth,b*costh);

	xr  = y - d*sinth - h*h*costh*costh*sinth/d;
	zr  = surface + d*costh - h*h*costh*sinth*sinth/d;

	xval[ith] = xr;
	zval[ith] = zr;
    }				
	
/*					Draw ellipse */
    vp_color(5);
    vp_upline(xval,zval,NARRAY);

    if (option) {
/*					Loop on theta to draw SRG raypaths */

	iflag = 0;
	emph  = 3;

	for (ith = 0; ith < NARRAY; ith +=5) {
	    iflag++;
	    thtmp = 90. - ith * dth;
	    thtmp = thtmp*SF_PI/180.;
	    tanth = tanf(thtmp);
	    sinth = sinf(thtmp);
	    costh = cosf(thtmp);

	    d = hypotf(a*sinth,b*costh);

	    xr  = y - d*sinth - h*h*costh*costh*sinth/d;
	    zr  = surface + d*costh - h*h*costh*sinth*sinth/d;

/*					Shot to reflection point */
	    vp_color(4);

	    x = xs;
	    z = surface;
	    x1 = xr;
	    z1 = zr;
	    if(iflag == emph) vp_color(6);
	    if(ith != 1 && ith != NARRAY) vp_uarrow(x,z,x1,z1,0.02*zmax);
	    if(iflag == emph) vp_color(4);
/*					Annotate beta */
	    xend = (xs + xr)/2.;
	    zend = (surface + zr)/2.;

	    if(iflag == emph) {
		vp_color(6);
		vp_utext(xend-slop,  zend+0.8*slop,8,0,"\\F9 b");
		vp_color(4);
	    }

/*					reflection point to geophone */
	    x = xr;
	    z = zr;
	    vp_umove(x,z);
	    x1 = xg;
	    z1 = surface;
	    if(iflag == emph) vp_color(6);

	    if(ith != 1 && ith != NARRAY) vp_uarrow(x,z,x1,z1,0.02*zmax);

	    if(iflag == emph) vp_color(6);
/*					Annotate alpha */
	    xend = (xg + xr)/2.;
	    zend = (surface + zr)/2.;

	    if(iflag == emph) {
		vp_color(6);
		vp_utext(xend+slop,  zend+0.5*slop,8,0,"\\F9 a");
		vp_color(4);
	    }
	    if(animate) {
		vp_erase();	      /* clear screen, then redraw basic stuff */
/* 					redraw and annotate surface */
		vp_fat(2*plotfat);
		vp_color(7);
		vp_umove(xmin,surface);		
		vp_udraw(xmax,surface);

		vp_color(5);
		vp_fat(plotfat);
		vp_tjust(4,6);
		vp_utext(xs-0.5*slop,surface-slop,8,0,"S");
		vp_utext(xg,surface-slop,8,0,"G");
		vp_utext(y,surface-slop,8,0,"M");

/*					redraw ellipse */
		vp_color(5);
		vp_upline(xval,zval,NARRAY);
	    }					   
	}				/* end loop on theta */

    } else {
/*					Begin work for drawing dipping layer */
        theta *= SF_PI/180.;
        tanth = tanf(theta);
        sinth = sinf(theta);
	costh = cosf(theta);

	d = hypotf(a*sinth,b*costh);

	xr  = y - d*sinth - h*h*costh*costh*sinth/d;
	zr  = surface + d*costh - h*h*costh*sinth*sinth/d;

	xsp = y - h   - 2*(d-h*sinth)*sinth;
	xstart = xsp;
	zstart = surface + d/costh + tanth * (xstart-y);
	xend = 0.5*(xg + y);
	zend = surface + d/costh + tanth * (xend-y);


/* 					Draw dipping reflector */
	vp_color(2);
	vp_umove(xstart,zstart);
	vp_udraw(xend,zend);
	vp_dash(0.,0.,0.,0.);
/*					indicate angle theta */
	vp_color(7);
	vp_dash(.1,.1,.1,.1);
	vp_umove(xend,zend);
	vp_udraw(xend-0.5*h,zend);
	vp_dash(.0,.0,.0,.0);

/* 					finite-offset raypaths */
	vp_color(4);

/*					Shot to reflection point */
 	vp_uarrow(xs,surface,xr,zr,0.02*zmax);
	
/*					reflection point to geophone */
	vp_uarrow(xr,zr,xg,surface,0.02*zmax);
	
/* 					text */


        vp_color(5);
        vp_fat(plotfat);
        vp_tjust(4,6);
        vp_utext(xr,zr+2.0*slop,8,0,"R");
 	vp_utext(xend-5*slop,  zend-1.*slop,8,0,"\\F9 q");
    }

    if(wantframe) {
	vp_dash(0.,0.,0.,0.);
	vp_color(7);
	vp_fat(1);
	vp_umove(xmin,zmin);
	vp_udraw(xmin,zmax);
	vp_udraw(xmax,zmax);
	vp_udraw(xmax,zmin);
	vp_udraw(xmin,zmin);
    }

    return 0;
}
Пример #12
0
void vertvwig(float *data, int n, int fill)
{
	int lpoly = 0;          /* Number of points in fill arrays */
	static float *xp, *yp;  /* Fill corner arrays              */
	register int i;         /* Counter for data points         */


	/* Allocate fill corner arrays if first entry.                */
	/* We keep the x, y values of the polygon to be filled in two */
	/* separate arrays.  The index lpoly points to the last corner.  */

	if (first) {
		xp = ealloc1float(n + 2);
		yp = ealloc1float(n + 2);
		vp_color(FILLCOLOR);
		first = false;
	}
	

	/* Initialize pen to top of trace */
	vp_umove(data[0], 0.0);


	/* Start fill arrays if first two x's are significantly positive. */
	/* This needs to be handled specially since we cannot detect the  */
	/* begin of fill by a previous non-fill point in this case.       */

	if (data[0] > WEPS) {

		/* Phoney first corner point to tie down the polygon */
		yp[0] = 0.0;    xp[0] = WEPS;

		/* Record the actual value */
		yp[1] = 0.0;    xp[1] = data[0];
		lpoly = 2;
	}
	

	if (fill) {

		/* Loop over interior data points */
		for (i = 1; i < n - 1; ++i) {
			vp_udraw(data[i], (float) i);


			/* If significantly > 0, add to the fill arrays  */
			if (data[i] > WEPS) {

				/* If previous point was not a fill corner, */
				/* space up proportionately to start fill   */
				/* and initialize fill arrays               */
				if (!lpoly) {
					yp[0] = i-data[i]/(data[i]-data[i-1]);
					xp[0] = WEPS;
					lpoly = 1;
				}

				/* Add this fill corner to the previous ones */
				yp[lpoly] = i;
				xp[lpoly] = data[i];
				++lpoly;
			}

			/* At end of fill region call uarea to do the fill */
			if (data[i] < WEPS && lpoly) {
				yp[lpoly] = i - data[i]/(data[i]-data[i-1]);
				xp[lpoly] = WEPS;
				++lpoly;
				if (lpoly > 2) vp_uarea(xp, yp, lpoly, 1, 1, 1);
				lpoly = 0;
			}


		} /* End of loop over interior points on trace */
		
	} else {

		/* Not filling, just connect the dots */
		for (i = 1; i < n - 1; ++i) {
			vp_udraw(data[i], (float) i);
		}
		
	} /* End if fill */


	/* Draw to last x, y on trace */
	vp_udraw(data[n-1], (float) n-1);


	/* Force out fill arrays at end of trace. */
	/* Tie down end of polygon.               */
	if (fill && lpoly) {
		yp[lpoly] = n - 1;
		xp[lpoly] = WEPS;
		++lpoly;
		if (lpoly > 2) vp_uarea(xp, yp, lpoly, 1, 1, 1);
	}
}
Пример #13
0
int main(int argc, char* argv[])
{
    int job;
    float x,y, rads, theta;
    sf_complex cs, cz;
    const int nfat=1, ntheta= 271;
    const float eps=0.1, k2=0.05;

    vp_init();

    for (job=0; job < 5; job++) {
	vp_uorig ( -1.75-2.20*job, -1.5 );
	vp_uclip (-1.,-1.,1.3,1.1);
	vp_fat (nfat);

	vp_umove (0.,-.9);  
	vp_udraw (0.,4.9);
	vp_umove (-.5,0.);  
	vp_udraw (1.2,0.);

	vp_utext(  .1,  .9,  4,0, "Im");
	vp_utext( 1.05, -.2, 4,0, "Re");

	switch (job) {
	    case 0:
		vp_utext( .1, -.7 , 4,0, "\\F10 w=+p");
		vp_utext( .1,  .6 , 4,0, "\\F10 w=-p");
		vp_utext( .1,  .05, 4,0, "\\F10 w=0");
		break;
	    case 1:
		vp_utext( .4, -.65, 4,0, "\\F10 w=p/2");
		vp_utext( .4,  .55, 4,0, "\\F10 w=-p/2");
		vp_utext( .1,  .05, 4,0, "\\F10 w=0");
		break;
	    default:
		break;
	}

	vp_fat(0);
	vp_penup();

	for( theta = -180.; theta<180.1; theta += 360./ntheta )  {
	    rads = 2. * SF_PI * theta / 360.;
	    cz = cexpf( sf_cmplx(0.,rads) );
#ifdef SF_HAS_COMPLEX_H	 
	    cs = (1.+eps - cz )/2.;
#else
	    cs = sf_crmul(sf_cadd(sf_cmplx(1.+eps,0.),sf_cneg(cz)),0.5);
#endif
	    
	    switch (job) {
		case 0: cs = sf_cmplx( .05, .8*theta/180.); break;
		case 1: break;
#ifdef SF_HAS_COMPLEX_H	 
		case 2: cs *= cs; break;
		case 3: cs = cs*cs + k2; break;
		case 4: cs = csqrtf( cs*cs + k2 ); break;
#else
		case 2: cs = sf_cmul(cs,cs); 
		    break;
		case 3: cs = sf_cadd(sf_cmul(cs,cs),sf_cmplx(k2,0.)); 
		    break;
		case 4: cs = csqrtf(sf_cadd(sf_cmul(cs,cs),sf_cmplx(k2,0.))); 
		    break;
#endif 
		default: break;
	    }

	    x = crealf( cs ); 
	    y = cimagf( cs );

	    vp_upendn ( x, -y);
	}
    }

    return 0;
}
Пример #14
0
int main(int argc, char* argv[])
{
    int n1,n2,n3, frame2,frame3, i1,i2,i3, iframe, np=3, orient;
    int n1pix,n2pix, m1pix,m2pix, n1front,n2front, movie, nframe=1; 
    float point1, point2, **front, **side, **top, **topt, *x, *y, o1, d1, o2, d2;    
    float min, max, f, frame1, dframe, oo1, dd1;
    bool nomin, nomax, yreverse;
    char *label1, *label2, *unit1, *unit2;
    off_t esize;
    bool flat;
    vp_contour cnt;
    sf_file in=NULL;

    sf_init(argc,argv);
    in = sf_input("in");
    vp_init();

    if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input");

    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    if (!sf_histint(in,"n2",&n2)) n2=1;
    n3 = sf_leftsize(in,2);

    esize = sf_esize(in);
    sf_unpipe(in,n1*n2*n3*esize);

    if (!sf_getint("orient",&orient)) orient=1;
    /* function orientation */

    if (!sf_getbool("yreverse",&yreverse)) yreverse=false;

    front = sf_floatalloc2(n1,1);
    side = sf_floatalloc2(1,n2);
    top = sf_floatalloc2(n1,n2);
    topt = (2==orient)? sf_floatalloc2(n2,n1): NULL;

    nomin = (bool) !sf_getfloat("min",&min);
    /* minimum function value */
    nomax = (bool) !sf_getfloat("max",&max);
    /* maximum function value */

    if (nomin) min = +FLT_MAX;
    if (nomax) max = -FLT_MAX;
    if (nomin || nomax) {
	for (i3=0; i3 < n3; i3++) {
	    sf_floatread(top[0],n1*n2,in);
	    for (i2=0; i2 < n2; i2++) {
		for (i1=0; i1 < n1; i1++) {
		    f = top[i2][i1];
		    if (nomax && f > max) max=f;
		    if (nomin && f < min) min=f;
		}
	    }
	}
    }


    if (min == 0. && max == 0.) {
	min = -1.;
	max = 1.;
    } else if (min == max) {
        max *= 1.04;
        min *= 0.96;
    }

    if (!sf_histfloat(in,"o1",&o1)) o1=0.;
    if (!sf_histfloat(in,"d1",&d1)) d1=1.;
    if (!sf_histfloat(in,"o2",&o2)) o2=0.;
    if (!sf_histfloat(in,"d2",&d2)) d2=1.;

    switch(orient) {
	case 1:
	default:    
	    dd1 = (min-max)/np;
	    oo1 = max+0.5*dd1;

	    sf_putint(in,"n1",np);
	    sf_putfloat(in,"o1",oo1);
	    sf_putfloat(in,"d1",dd1);

	    sf_putint(in,"n2",n1);
	    sf_putfloat(in,"o2",o1);
	    sf_putfloat(in,"d2",d1);

	    sf_putint(in,"n3",n2);
	    sf_putfloat(in,"o3",o2);
	    sf_putfloat(in,"d3",d2);

	    break;
	case 2:
	    dd1 = (max-min)/np;
	    oo1 = min+0.5*dd1;

	    sf_putint(in,"n2",np);
	    sf_putfloat(in,"o2",oo1);
	    sf_putfloat(in,"d2",dd1);

	    sf_putint(in,"n3",n2);
	    sf_putfloat(in,"o3",o2);
	    sf_putfloat(in,"d3",d2);

	    break;
	case 3:
	    dd1 = (max-min)/np;
	    oo1 = min+0.5*dd1;

	    sf_putint(in,"n1",n2);
	    sf_putfloat(in,"o1",o2);
	    sf_putfloat(in,"d1",d2);

	    sf_putint(in,"n2",n1);
	    sf_putfloat(in,"o2",o1);
	    sf_putfloat(in,"d2",d1);

	    sf_putint(in,"n3",np);
	    sf_putfloat(in,"o3",oo1);
	    sf_putfloat(in,"d3",dd1);

	    break;
    }

    label1 = sf_histstring(in,"label1");
    label2 = sf_histstring(in,"label2");

    if (NULL != label1) {
	sf_putstring(in,"label1","");
	sf_putstring(in,"label2",label1);
	free(label1);
    }
    if (NULL != label2) {
	sf_putstring(in,"label3",label2);
	free(label2);
    }

    unit1 = sf_histstring(in,"unit1");
    unit2 = sf_histstring(in,"unit2");

    if (NULL != unit1) {
	sf_putstring(in,"unit1","");
	sf_putstring(in,"unit2",unit1);
	free(unit1);
    }
    if (NULL != unit2) {
	sf_putstring(in,"unit3",unit2);
	free(unit2);
    }

    if (!sf_getfloat("point1",&point1)) point1=0.5;
    /* fraction of the vertical axis for front face */
    if (!sf_getfloat("point2",&point2)) point2=0.5;
    /* fraction of the horizontal axis for front face */

    if (!sf_getfloat("frame1",&frame1)) frame1=0.5*(min+max);
    if (!sf_getint("frame2",&frame2)) frame2=n1-1;
    if (!sf_getint("frame3",&frame3)) frame3=0;
    /* frame numbers for cube faces */

    /* sanity check */
    if (min < max) {
	if (frame1 < min) frame1 = min;
	if (frame1 > max) frame1 = max;
    } else {
	if (frame1 > min) frame1 = min;
	if (frame1 < max) frame1 = max;
    }
    if (frame2 < 0) frame2 = 0;
    if (frame3 < 0) frame3 = 0;
    if (frame2 >= n1) frame2 = n1-1;
    if (frame3 >= n2) frame3 = n2-1;

    if (!sf_getint("movie",&movie)) movie=0;
    /* 0: no movie, 1: movie over axis 1, 2: axis 2, 3: axis 3 */

    if (!sf_getfloat("dframe",&dframe)) dframe=1;
    /* frame increment in a movie */

    switch (movie) {
	case 0:
	    nframe = 1;
	    break;
	case 1:
	    nframe = 0.5+(max-frame1)/dframe;
	    break;
	case 2:
	    nframe = (n1-frame2)/dframe;
	    break;
	case 3:
	    nframe = (n2-frame3)/dframe;
	    break;
	default:
	    sf_error("movie=%d is outside [0,3]",movie);
	    break;
    }

    if (sf_getint("nframe",&iframe) && iframe < nframe) nframe=iframe;
    /* number of frames in a movie */

    if (nframe < 1) nframe=1;

    if (!sf_getint("n1pix",&n1pix)) n1pix = n1/point1+n3/(1.-point1);
    /* number of vertical pixels */
    if (!sf_getint("n2pix",&n2pix)) n2pix = n2/point2+n3/(1.-point2);
    /* number of horizontal pixels */

    m1pix = VP_STANDARD_HEIGHT*72;
    m2pix = VP_STANDARD_HEIGHT*72/VP_SCREEN_RATIO;

    if (n1pix < m1pix) n1pix=m1pix;
    if (n2pix < m2pix) n2pix=m2pix;

    n1front = n1pix*point1;
    n2front = n2pix*point2;

    if (n1front <= 0) n1front=1;
    if (n2front <= 0) n2front=1;
    if (n1front >= n1pix) n1front=n1pix-1;
    if (n2front >= n2pix) n2front=n2pix-1;

    x = sf_floatalloc(n1);
    y = sf_floatalloc(n2);

    for (i1=0; i1 < n1; i1++) {
	x[i1] = o1 + i1*d1;
    }

    for (i2=0; i2 < n2; i2++) {
	y[i2] = o2 + i2*d2;
    }

    if (!sf_getbool("flat",&flat)) flat=true;
    /* if n, display perspective view */

    vp_cubeplot_init (n1pix, n2pix, n1front, n2front, flat, false); 
    vp_frame_init (in,"blt",false);
    vp_plot_init(n3);
    cnt = vp_contour_init(false,
			  n1,o1,d1,0.,
			  n2,o2,d2,0.); 

    for (iframe=0; iframe < nframe; iframe++) {
	if (iframe > 0) vp_erase (); 

	for (i3=0; i3 < n3; i3++) {
	    vp_plot_set (i3);

	    /* front face */

	    switch(orient) {
		case 1:
		default:
		    sf_seek(in,(off_t) (i3*n1*n2+frame3*n1)*esize,SEEK_SET);
		    sf_floatread(front[0],n1,in);
		    
		    vp_cubecoord(3,x[0],x[n1-1],min,max);
		    vp_umove(x[0],front[0][0]);
		    for (i1=1; i1 < n1; i1++) {
			vp_udraw(x[i1],front[0][i1]);
		    }

		    break;
		case 2:
		    sf_seek(in,(off_t) (i3*n1*n2+frame3*n1)*esize,SEEK_SET);
		    sf_floatread(front[0],n1,in);

		    if (yreverse) {
			vp_cubecoord(3,min,max,x[n1-1],x[0]);
			vp_umove(front[0][n1-1],x[n1-1]);
			for (i1=n1-2; i1 >= 0; i1--) {
			    vp_udraw(front[0][i1],x[i1]);
			}
		    } else {
			vp_cubecoord(3,min,max,x[0],x[n1-1]);
			vp_umove(front[0][0],x[0]);
			for (i1=1; i1 < n1; i1++) {
			    vp_udraw(front[0][i1],x[i1]);
			}
		    }
		    
		    break;
		case 3:
		    sf_seek(in,(off_t) (i3*n1*n2*esize),SEEK_SET);
		    sf_floatread(top[0],n1*n2,in);

		    vp_cubecoord(3,x[0],x[n1-1],y[0],y[n2-1]);
		    vp_contour_draw(cnt,false,top,frame1);

		    break;
	    }
		    

	    /* side face */

	    switch(orient) {
		case 1:
		default:	    
		    for (i2=0; i2 < n2; i2++) {
			sf_seek(in,(off_t) (i3*n1*n2+i2*n1+frame2)*esize,SEEK_SET);
			sf_floatread(side[i2],1,in);
		    }
		    
		    vp_cubecoord(2,y[0],y[n2-1],min,max);
		    vp_umove(y[0],side[0][0]);
		    for (i2=1; i2 < n2; i2++) {
			vp_udraw(y[i2],side[i2][0]);
		    }

		    break;
		case 2:
		    sf_seek(in,(off_t) (i3*n1*n2*esize),SEEK_SET);
		    sf_floatread(top[0],n1*n2,in);

		    /* transpose */
		    for (i2=0; i2 < n2; i2++) {
			for (i1=0; i1 < n1; i1++) {
			    topt[i1][i2] = top[i2][i1];
			}
		    }
		    
		    if (yreverse) {
			vp_cubecoord(2,y[0],y[n2-1],x[n1-1],x[0]);
		    } else {
			vp_cubecoord(2,y[0],y[n2-1],x[0],x[n1-1]);
		    }
		    vp_contour_draw(cnt,false,topt,frame1);
		    
		    break;
		case 3:
		    for (i2=0; i2 < n2; i2++) {
			sf_seek(in,(off_t) (i3*n1*n2+i2*n1+frame2)*esize,SEEK_SET);
			sf_floatread(side[i2],1,in);
		    }
		    
		    vp_cubecoord(2,min,max,y[0],y[n2-1]);
		    vp_umove(side[0][0],y[0]);
		    for (i2=1; i2 < n2; i2++) {
			vp_udraw(side[i2][0],y[i2]);
		    }

		    break;
	    }

	    /* top face */

	    switch(orient) {
		case 1:
		default:
		    sf_seek(in,(off_t) (i3*n1*n2*esize),SEEK_SET);
		    sf_floatread(top[0],n1*n2,in);
		    
		    vp_cubecoord(1,x[0],x[n1-1],y[0],y[n2-1]);
		    vp_contour_draw(cnt,false,top,frame1);

		    break;
		case 2:
		    for (i2=0; i2 < n2; i2++) {
			sf_seek(in,(off_t) (i3*n1*n2+i2*n1+frame2)*esize,SEEK_SET);
			sf_floatread(side[i2],1,in);
		    }
		    
		    vp_cubecoord(1,min,max,y[0],y[n2-1]);
		    vp_umove(side[0][0],y[0]);
		    for (i2=1; i2 < n2; i2++) {
			vp_udraw(side[i2][0],y[i2]);
		    }
		    
		    break;
		case 3:
		    sf_seek(in,(off_t) (i3*n1*n2+frame3*n1)*esize,SEEK_SET);
		    sf_floatread(front[0],n1,in);
		    
		    vp_cubecoord(1,x[0],x[n1-1],min,max);
		    vp_umove(x[0],front[0][0]);
		    for (i1=1; i1 < n1; i1++) {
			vp_udraw(x[i1],front[0][i1]);
		    }

		    break;
	    }
	}
	
	vp_plot_unset();
	vp_coordinates();

	switch(orient) {
	    case 1:
	    default:
		vp_cubeframe((frame1-oo1)/dd1,frame2,frame3);
		break;
	    case 2:
		vp_cubeframe(frame2,(frame1-oo1)/dd1,frame3);
		break;
	    case 3:
		vp_cubeframe(frame2,frame3,(frame1-oo1)/dd1);
		break;
	}
	
	switch (movie) {
	    case 2:
		frame2 += (int) dframe;
		break;
	    case 3:
		frame3 += (int) dframe;
		break;
	    case 1:
		frame1 += dframe;
		break;
	    default:
		break;
	}

	vp_purge(); 
    } /* frame loop */


    exit(0);
}
Пример #15
0
int main(int argc, char* argv[])
{
    bool transp, start, scalebar, nomin=true, nomax=true, barreverse, framenum;
    int n1, n2, n3, i1, i2, i3, len, nreserve;
    float min1, max1, min2, max2, o3, d3, o1, d1, xi, yi, tt;
    float **x, **y, **tmp, *symbolsz=NULL, symsize, xc, yc;    
    float ***data=NULL, barmin, barmax, minmax[2];
    char *symbol, sym[2]=" ", *color=NULL, *barfile;
    unsigned char **z=NULL, *barbuf[1];
    sf_datatype type;
    sf_file in, depth, bar=NULL;

    sf_init(argc,argv);
    in = sf_input("in");
    vp_init();

    if (NULL != sf_getstring("depth")) {
	depth = sf_input("depth"); /* values for colored plots */
	if (SF_UCHAR != sf_gettype(depth)) 
	    sf_error("Need uchar in depth");
    } else {
	depth = NULL;
    }

    if (!sf_histint(in,"n1",&n1)) sf_error("No n1= in input");
    if (!sf_histint(in,"n2",&n2)) n2=1;
    n = n1*n2;
    n3 = sf_leftsize(in,2);
    if (n3 > 1) {
	if (!sf_histfloat(in,"o3",&o3)) o3=0.;
	if (!sf_histfloat(in,"d3",&d3)) d3=1.;
    }

    x = sf_floatalloc2(n1,n2);
    y = sf_floatalloc2(n1,n2);
    t = sf_floatalloc(n);

    if (!sf_getbool("scalebar",&scalebar)) scalebar=false;
    /* if y, draw scalebar */

    if (!sf_getbool("wantframenum",&framenum)) framenum = (bool) (n3 > 1);
    /* if y, display third axis position in the corner */
    
    if (NULL != depth) {
	z = sf_ucharalloc2(n1,n2);
	/* initialize color table */
	if (NULL == (color = sf_getstring("color"))) color="j";
	/* color scheme (default is j) */
	if (!sf_getint ("nreserve",&nreserve)) nreserve = 8;
	/* reserved colors */
	vp_rascoltab(nreserve,color);

	if (scalebar) {
	    barfile = sf_getstring("bar");
	    /* file for scalebar data */
	    if (NULL == barfile) {
		barfile=sf_histstring(depth,"bar");
		if (NULL == barfile) sf_error("Need bar=");
	    }

	    nomin = (bool) (!sf_getfloat("minval",&barmin));
	    /* minimum value for scalebar (default is the data minimum) */
	    nomax = (bool) (!sf_getfloat("maxval",&barmax));
	    /* maximum value for scalebar (default is the data maximum) */
	
	    bar = sf_input(barfile);
	    if (SF_UCHAR != sf_gettype(bar)) sf_error("Need uchar in bar");

	    if (nomin) nomin = (bool) (!sf_histfloat(bar,"minval",&barmin));
	    if (nomax) nomax = (bool) (!sf_histfloat(bar,"maxval",&barmax));

	    barbuf[0] = (unsigned char*) sf_alloc(VP_BSIZE,sizeof(unsigned char));

	    if (!sf_getbool("barreverse",&barreverse)) barreverse=false;
	    /* if y, go from small to large on the bar scale */
	}
    } 

    if (!sf_getfloat("pclip",&pclip)) pclip=100.; /* clip percentile */

    type = sf_gettype(in);
    switch (type) {
	case SF_FLOAT:
	    if (!sf_histfloat(in,"o1",&o1)) o1=0.;
	    if (!sf_histfloat(in,"d1",&d1)) d1=1.;
	    
	    for (i2=0; i2 < n2; i2++) {
		for (i1=0; i1 < n1; i1++) {
		    x[i2][i1] = o1 + i1*d1;
		}
	    }
	    break;
	case SF_COMPLEX:
	    data = sf_floatalloc3(2,n1,n2);
	    break;
	default:
	    sf_error("Wrong data type (need float or complex)");
    }

    vp_plot_init(n2);

    symbol = sf_getstring("symbol");
    /* if set, plot with symbols instead of lines */
    if (NULL != symbol) {
	len = strlen(symbol);
	if (len < n2) {
	    symbol = (char*) sf_realloc(symbol,n2,sizeof(char));
	    for (i2=len; i2 < n2; i2++) {
		symbol[i2] = symbol[i2 % len];
	    }
	}

	symbolsz = sf_floatalloc(n2);
	if (!sf_getfloats("symbolsz",symbolsz,n2)) {
	    /* symbol size (default is 2) */
	    for (i2 = 0; i2 < n2; i2++)
		symbolsz[i2] = 2./33.;
	} else {
	    for (i2 = 0; i2 < n2; i2++)
		symbolsz[i2] /= 33.;
	}
    }

    if (!sf_getbool ("transp",&transp)) transp=false;
    /* if y, transpose the axes */
 
    for (i3 = 0; i3 < n3; i3++) {
	if (SF_COMPLEX == type) {
	    sf_floatread(data[0][0],2*n,in);
	    for (i2=0; i2 < n2; i2++) {
		for (i1=0; i1 < n1; i1++) {
		    x[i2][i1] = data[i2][i1][0];
		    y[i2][i1] = data[i2][i1][1];
		}
	    }
	    getminmax(x[0],&min1,&max1);
	} else {
	    sf_floatread(y[0],n,in);
	    min1=o1;
	    max1=o1+(n1-1)*d1;
	}
	getminmax(y[0],&min2,&max2);

	if (NULL != depth) sf_ucharread(z[0],n,depth);
	
	vp_stdplot_init (min1, max1, min2, max2,
			 transp,false,false,true);
	vp_frame_init(in,"blt",false);

	if (transp) {
	    tmp=x; x=y; y=tmp;
	    tt=max1; max1=max2; max2=tt;
	    tt=min1; min1=min2; min2=tt;
	}

	if (i3 > 0) vp_erase();

	if (framenum) vp_framenum(o3+i3*d3);
	vp_frame();

	for (i2=0; i2 < n2; i2++) {
	    vp_plot_set (i2);
	    
	    symsize = 2./33.;
	    if (NULL != symbol) {
		sym[0] = symbol[i2];
		symsize = symbolsz[i2];
	    } 

	    start = true;

	    for (i1=0; i1 < n1; i1++) {
		xi = x[i2][i1];
		yi = y[i2][i1];
		if (NULL != depth) vp_color(z[i2][i1]+256);

		if (isfinite(xi) && 
		    isfinite(yi)) {
		    if (NULL != symbol) {
			vp_umove(xi,yi);
			vp_where (&xc, &yc);
			vp_tjust (TH_SYMBOL, TV_SYMBOL);
			vp_gtext (xc,yc,symsize,0.,0.,symsize,sym);
		    } else if (start) {
			vp_umove(xi,yi);
			start=false;
		    } else {
			vp_udraw(xi,yi);
		    }
		} else {
		    start=true;
		}
	    }
	}

	if (depth && scalebar) {
	    sf_floatread(minmax,2,bar);
	    sf_ucharread(barbuf[0],VP_BSIZE,bar);

	    if (nomin) barmin=minmax[0];
	    if (nomax) barmax=minmax[1];

	    if (barreverse) {
		vp_barframe_init (depth,barmax,barmin);
	    } else {
		vp_barframe_init (depth,barmin,barmax);
	    }
	    vp_barraster(VP_BSIZE, barbuf);
	}
	
	if (transp) {
	    tmp=x; x=y; y=tmp;
	    tt=max1; max1=max2; max2=tt;
	    tt=min1; min1=min2; min2=tt;
	}
    } 
   

    exit(0);
}