AT&T Home | AT&T Labs | Research

# The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
arc (Number x, Number y, Number r, Number a1, Number a2 [, Number sx, Number sy]) typedict.Path

Adds an arc to this path that has its center at `(x, y)`, radius r, and extends from angle a1 to angle a2, which are interpreted as degrees and measured in the direction that takes the positive x-axis into the positive y-axis when the angle is positive. All numbers are transformed using the CTM associated with this path when arc is called, which means subsequent changes to CTM do not affect this arc.

If there is a current point arc draws a line segment from that point to the first endpoint,

```(r*cos(a1), r*sin(a1)) ```
and then draws an arc from that point to the second endpoint,
```(r*cos(a2), r*sin(a2)) ```
which becomes the new current point. The arc is circular in user space unless the optional scaling arguments sx and sy say otherwise. Omitting sx and sy or supplying them with values of `1.0` are equivalent.
 Example: The program ```import yoix.*.*; JFrame f = { Color background = Color.white; paint(Rectangle r) { graphics { // "named block" gsave(); translate(size.width/2, size.height/2); scale(2, -2); newpath(); arc(0, 0, 50, 45, 135); arcn(0, 0, 25, 135, 45); gsave(); // saves path setgray(.5); fill(); grestore(); // restores path setrgbcolor(1, 0, 0); stroke(); grestore(); } } }; f.visible = TRUE; ```creates a path using arc and arcn that we first fill with a shade of gray and then outline in red. Notice how we saved the path before filling it and omitted a closepath after describing the last arc. This example and the one in the arcn reference page are almost identical, but they produce different results that you should be able to explain. Return: Path See Also: arcn, closepath, currentpath, currentpoint, curveto, flattenpath, Graphics, lineto, moveto, newpath, pathbbox, pathforall, quadto, rcurveto, rlineto, rmoveto, rquadto

Yoix is a registered trademark of AT&T Inc.