home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #ifdef AMIGA
- #include <gfxamiga.h>
- #else
- #include <gfx.h>
- #endif
-
- int dot_flg=TRUE,
- bar_flg=FALSE,
- vec_flg=FALSE,
- point_style=0,
- point_size=0;
-
- help()
- {
- printf("plot a point on the grafic screen\n");
- printf("point x y [options]\n");
- printf(" -v draws vectors \n");
- printf(" -c draws circles\n");
- printf(" -cir n draws circles with radius n.m\n");
- printf(" -crf n draws filled circles with radius n\n");
- printf(" -tri n draws triangles with baseline n (negative n gives\n");
- printf(" inverted triangles)\n");
- printf(" -trf n draws filled triangles with baseline n\n");
- printf(" -qua n draws quadrates with baseline n\n");
- printf(" -qaf n draws filled quadrates with baseline n\n");
- }
-
- disp(y,t) /* plot a point in the window */
- int y,t;
- {
- int n,m,xx,yy;
- float fx1,fx2,fy1,fy2,fr,phi,finc;
-
- xx=t; yy=y;
- if(dot_flg) {
- posita(xx,yy); vectoa(xx,yy);
- }
- if(vec_flg) {
- vectoa(xx,yy);
- }
- switch(point_style) {
- case 0:
- return(0);
- break;
- case 1: /* circle */
- fr=point_size;
- xx = t ; yy = y+fr; posita(xx,yy);
- finc=1.57079/fr;
- phi=finc;
- fx1=0; fy1=fr;
- for(n=0; n < (4*point_size); n++) {
- fx2=fr*sin(phi); fy2=fr*cos(phi);
- xx = t + fx2; yy = y + fy2; vectoa(xx,yy);
- phi=phi+finc;
- }
- xx=t; yy=y; posita(xx,yy);
- break;
- case 2: /* filled circle */
- fr=point_size;
- phi=0.0;
- finc=1.57079/fr;
- fx1=0; fy1=fr;
- for(n=0; n <= (point_size + 1);n++) {
- fx2=fr*sin(phi); fy2=fr*cos(phi);
- xx=(t+fx1); yy=(y+fy1); posita(xx,yy);
- xx=(t-fx1); vectoa(xx,yy);
- yy=(y-fy1); posita(xx,yy);
- xx=(t+fx1); vectoa(xx,yy);
- fx1=fx2; fy1=fy2;
- phi=phi+finc;
- }
- xx=t; yy=y; posita(xx,yy);
- break;
- case 3: /* triangle */
- xx=t+point_size; yy=y-point_size; posita(xx,yy);
- xx=t-point_size; vectoa(xx,yy);
- yy=y+point_size; xx=t; vectoa(xx,yy);
- xx=t+point_size; yy=y-point_size; vectoa(xx,yy);
- xx=t; yy=y; posita(xx,yy);
- break;
- case 4: /* filled triangle */
- xx=t-point_size;
- for(n=0;n<(2*point_size);n++) {
- yy=y+point_size; posita((int)t,yy);
- yy=y-point_size; vectoa(xx,yy);
- xx=xx+1;
- }
- xx=t; yy=y; posita(xx,yy);
- break;
- case 5: /* quadrate */
- xx=t+point_size; yy=y-point_size; posita(xx,yy);
- xx=t-point_size; vectoa(xx,yy);
- yy=y+point_size; vectoa(xx,yy);
- xx=t+point_size; vectoa(xx,yy);
- yy=y-point_size; vectoa(xx,yy);
- xx=t; yy=y; posita(xx,yy);
- break;
- case 6: /* filled quadrate */
- yy=y-point_size;
- for(n=0;n<(2*point_size);n++) {
- xx=t+point_size; posita(xx,yy);
- xx=t-point_size; vectoa(xx,yy);
- yy=yy+1;
- }
- xx=t; yy=y; posita(xx,yy);
- break;
- }
- }
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- int x,y,n,m,v[8];
- char z[80];
-
- x=atoi(argv[1]);
- y=atoi(argv[2]);
-
- if(checkopt(argc,argv,"-v",z)) {
- dot_flg=FALSE;
- vec_flg=TRUE;
- }
- if(checkopt(argc,argv,"-c",z)) {
- dot_flg=FALSE;
- point_style=1;
- point_size=4;
- }
- if(checkopt(argc,argv,"-cir",z)) {
- dot_flg=FALSE;
- point_style=1;
- point_size=atoi(z);
- }
- if(checkopt(argc,argv,"-crf",z)) {
- dot_flg=FALSE;
- point_style=2;
- point_size=atoi(z);
- }
- if(checkopt(argc,argv,"-tri",z)) {
- dot_flg=FALSE;
- point_style=3;
- point_size=atoi(z);
- }
- if(checkopt(argc,argv,"-trf",z)) {
- dot_flg=FALSE;
- point_style=4;
- point_size=atoi(z);
- }
- if(checkopt(argc,argv,"-qua",z)) {
- dot_flg=FALSE;
- point_style=5;
- point_size=atoi(z);
- }
- if(checkopt(argc,argv,"-qaf",z)) {
- dot_flg=FALSE;
- point_style=6;
- point_size=atoi(z);
- }
-
- tekopen();
-
- disp(y,x);
- gfxflush();
- close(_tek4014);
- return(0);
- }
-