예제 #1
0
void right(int g,int h,int e,int f)
{
int i,a,b,c,d,j=7;
for(i=0;i<8;i++)
{
line(g,h,e,f);
line(g,h,e-10,f+20);
line(g,h+10,e,f+30);
line(g+10,h+20,e+10,f+20);
line(g+20,h+10,e+10,f+10);
line(g+20,h,e,f);
a=g;
b=h+10;
c=e;
d=f+30;
g=g+10;
h=h+20;
e=e+10;
f=f+20;
if(a>=320 && a<=380 && b>=140 && b<=260 && c>=330 && c<=390 && d>=150 && d<=270)
{
left1(a,b,c,d,j) ;
}

j=j-1;
}
if(a==390 && b==280 && c==400 && d==290)
{
left1(a,b,c,d,7);
}
}
int main(int argc, char *argv[]){
 
  char s[] = "abcd1234";
  left1(s, 8, 4);
  puts(s);
  puts(left2(s, 8, 4));

  return 0;
  

}
예제 #3
0
파일: Mpwd1.c 프로젝트: 1014511134/src
int main (int argc, char *argv[])
{
    bool left;
    int ir, nr, n1,n2,n3, m1, m2, m3, n12, nw, nj1, nj2, i3;
    float *u1, *u2, *p;
    sf_file in, out, dip;
    allpass ap;

    sf_init(argc,argv);
    in = sf_input ("in");
    dip = sf_input ("dip");
    out = sf_output ("out");

    if (SF_FLOAT != sf_gettype(in) ||
	SF_FLOAT != sf_gettype(dip)) sf_error("Need float type");

    if (!sf_histint(in,"n1",&n1)) sf_error("Need n1= in input");
    if (!sf_histint(in,"n2",&n2)) n2=1;
    if (!sf_histint(in,"n3",&n3)) n3=1;
    n12 = n1*n2;
    nr = sf_leftsize(in,3);

    if (!sf_getbool("left",&left)) left=true;
    /* if using left or right side of PWD */

    if (!sf_histint(dip,"n1",&m1) || m1 != n1) 
	sf_error("Need n1=%d in dip",n1);
    if (1 != n2 && (!sf_histint(dip,"n2",&m2) || m2 != n2)) 
	sf_error("Need n2=%d in dip",n2);
    if (1 != n3 && (!sf_histint(dip,"n3",&m3) || m3 != n3)) 
	sf_error("Need n3=%d in dip",n3);

    if (!sf_getint("order",&nw)) nw=1;
    /* accuracy */
    if (!sf_getint("nj1",&nj1)) nj1=1;
    /* in-line aliasing */
    if (!sf_getint("nj2",&nj2)) nj2=1;
    /* cross-line aliasing */

    for (ir=0; ir < nr; ir++) {
	u1 = sf_floatalloc(n12);
	u2 = sf_floatalloc(n12);
	p  = sf_floatalloc(n12);
	    
	for (i3=0; i3 < n3; i3++) {
	    /* read data */
	    sf_floatread(u1,n12,in);
	    
	    /* read t-x dip */
	    sf_floatread(p,n12,dip);
		
	    ap = allpass_init (nw,nj1,n1,n2,1,p);
		
	    /* apply */
	    if (left) {
		left1(false, false, ap, u1, u2);
	    } else {
		right1(false, false, ap, u1, u2);
	    }
		
	    /* write t-x destruction */
	    sf_floatwrite(u2,n12,out);
	}
	
	free(u1);
	free(u2);
	free(p);
	    
    }
    
    exit (0);
}