Name
arc()
Description
Draws an arc to the screen. Arcs are drawn along the outer edge of an ellipse
defined by the a, b, c, and d parameters. The
origin of the arc's ellipse may be changed with the ellipseMode()
function. Use the start and stop parameters to specify the
angles (in radians) at which to draw the arc. The start/stop values must be
in clockwise order.
There are three ways to draw an arc; the rendering technique used is defined
by the optional seventh parameter. The three options, depicted in the above
examples, are PIE, OPEN, and CHORD. The default mode is the OPEN stroke with
a PIE fill.
In some cases, the arc() function isn't accurate enough for smooth
drawing. For example, the shape may jitter on screen when rotating slowly. If
you're having an issue with how arcs are rendered, you'll need to draw the
arc yourself with beginShape()/endShape() or a PShape.
Examples
size(400,400); arc(50, 55, 50, 50, 0, HALF_PI); noFill(); arc(50, 55, 60, 60, HALF_PI, PI); arc(50, 55, 70, 70, PI, PI+QUARTER_PI); arc(50, 55, 80, 80, PI+QUARTER_PI, TWO_PI);
size(400,400); arc(200, 200, 320, 320, 0, PI+QUARTER_PI, OPEN);
size(400,400); arc(200, 200, 320, 320, 0, PI+QUARTER_PI, CHORD);
size(400,400); arc(200, 200, 320, 320, 0, PI+QUARTER_PI, PIE);
Syntax
arc(a, b, c, d, start, stop)
arc(a, b, c, d, start, stop, mode)
Parameters
a
(float)
x-coordinate of the arc's ellipseb
(float)
y-coordinate of the arc's ellipsec
(float)
width of the arc's ellipse by defaultd
(float)
height of the arc's ellipse by defaultstart
(float)
angle to start the arc, specified in radiansstop
(float)
angle to stop the arc, specified in radians
Return
void
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.