Sun Microsystems 800-1256-04 — Sun Microsystems 800-1256-04 SunCGI Reference Manual PDF

Chapter 3 - Output 39 0 circular_arc_center draws a circular arc between points c2x, c2y and c3x, c3y with circle of radius rad at center cl . Point c2x, c2y is the starting point and point c3x, c3y is the ending point. Circular arcs are drawn in a coun- terclockwise manner. This convention is used to determine the difference between the arc formed by the smaller angle determined by c2x, c2y, cl and c3x, c3y and the larger angle specified by these same points. Therefore switch- ing the values of c2x, c2y and c3x, c3y will produce arcs which total 360 degrees. If rad is negative, the points 180 degrees opposite from c2x, c2y and c3x, c3y are used as the endpoints of the arc.

If the rad is zero, a point is drawn at cl . If either c2x, c2y or c3x, c3y are not on the circumference of the circle determined by cl and rad, an error is gen- erated and the arc is not drawn. The attributes which determine the style, width, and color of the arc are the same functions which regulate the drawing of poly- lines. CGI not in proper state: CGI shall be in state VSAC. Errors ENOTVSAC [4] Arc points do not lie on circle.

EARCPNCI [64] Circular Arc C~nter Close Cerror circular_arc_center_close(cl, c2x, c2y, c3x, c3y, rad, close) Ccoor *cl; /*center*/ Cint c2x, c2y, c3x, c3y; /*endpoints*/ Cint rad; /*radius*/ Cclosetype close; /* PIE or CHORD *I 0 circular_arc_center_close draws a closed arc centered at cl with radius rad and endpoints c2x, c2y and 3x, c3y . Arcs are closed with either the PIE or CHORD algorithm. The PIE algorithm draws a line from each of the end- points of the arc to the center point of the circle. SunCGI then fills this region as it would any other solid object. The CHORD algorithm draws a line connecting the endpoints of the arc and then fills this region using solid object attributes.

circular_arc_center_close is useful for drawing pie charts (see fol- lowing example): 0 Version C of 17 March 1986