📄 drawbox.c
字号:
/*--------------------------------------------------------------+| ENTROPIC PROCESSING, INC. || || This material contains proprietary software of Entropic || Processing, Inc. Any reproduction, distribution, or || publication without the the prior written permission of || Entropic Processing, Inc. is strictly prohibited. Any || public distribution of copies of this work authorized in || writing by Entropic Processing, Inc. must bear the notice || || "Copyright 1986 Entropic Processing, Inc." || |+---------------------------------------------------------------+| || draw_box -- draw labeled box in a form suitable for plotas || || Shankar Narayan, EPI || Adapted by Joseph T. Buck. || |+--------------------------------------------------------------*/#ifdef SCCS static char *sccs_id = "@(#)drawbox.c 1.1 9/9/86 EPI";#endifdraw_box (xmin, xmax, xstep, xdp, ymin, ymax, ystep, ydp)double xmin, xmax, xstep, ymin, ymax, ystep;{ char xfmt[10], yfmt[10]; double tmp; int ix, iy; (void) sprintf (xfmt, "%%5.%df\n", xdp); (void) sprintf (yfmt, "%%5.%df\n", ydp); printf ("\nc 1\n"); printf ("m 500 500\n"); printf ("d 500 5500\nd 3000 5500\nd 3000 500\nd 500 500\n"); printf ("c 2\n"); /* Draw vertical grid */ for (tmp = xmin; tmp <= xmax; tmp = tmp + xstep) { ix = 500 + 5000 * (tmp - xmin) / (xmax - xmin); printf ("m 500 %4d\n", ix); printf ("d 3000 %4d\n", ix); printf ("m 3260 %4d\nt 5 1\n", ix - 150); printf (xfmt, tmp); } /* Draw ticks */ for (tmp = xmin + xstep / 2; tmp <= xmax; tmp = tmp + xstep) { ix = 500 + 5000 * (tmp - xmin) / (xmax - xmin); printf ("m 475 %4d\n", ix); printf ("d 525 %4d\n", ix); printf ("m 2975 %4d\n", ix); printf ("d 3025 %4d\n", ix); } /* Draw horizontal grid */ for (tmp = ymin; tmp <= ymax; tmp = tmp + ystep) { iy = 3000 - 2500 * (tmp - ymin) / (ymax - ymin); printf ("m %4d 5500\n", iy); printf ("d %4d 500\n", iy); printf ("m %4d 0\nt 5 1\n", iy + 100); printf (yfmt, tmp); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -