📄 polyline.c
字号:
#include <phigs.h> /* get HP-PHIGS definitions for C */#include <stdio.h> /* get standard I/O definitions */#include <math.h> /* link with library "-lm" */#define deg *3.14159265358979/180. /* convert degrees to radians */main() /* file "Polyline.c" */{ Pint WorkstnID = 1; /* workstation identifier */ Pint ConnID; /* connection identifier */ Pint WorkstnType = POIDDX; /* out/in, direct, dbl bfr, Xwindow */ Pint TheStructure = 1; /* structure ID (chosen by user) */ Ppoint PentagonPts[100]; /* for the XYs of the polyline */ Ppoint_list Pentagon; /* for the polyline */ float Theta = 0, Radius = 0; /* temporary variables */ int I; /* loop control variable */ popen_phigs((char *) stderr, 0); /* errors go to "stderr" */ pescape_u4("/dev/screen/phigs_window", &ConnID); popen_ws(WorkstnID, (void *) ConnID, WorkstnType); popen_struct(TheStructure); for (I = 0; I < 100; I++) { /* for each point... */ PentagonPts[I].x = (Radius * cos(Theta) + 1) * 0.5; PentagonPts[I].y = (Radius * sin(Theta) + 1) * 0.5; Theta += 73 deg; /* roughly pentagonal */ Radius += 0.01; /* enlarge it slightly */ } Pentagon.num_points = 100; Pentagon.points = PentagonPts; ppolyline(&Pentagon); /* polyline with 100 points */ pclose_struct(); ppost_struct(WorkstnID, TheStructure, 1.0); pupd_ws(WorkstnID, PFLAG_PERFORM); /* (regeneration flag) */ pclose_ws(WorkstnID); pclose_phigs();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -