Skip to main content

arc

arc() 

Draws a circular segment.

Note that two of the three angle arguments (start, stop and delta) must be set. The current position () gets updated to the arc’s end coordinate (anchor arc-end).

Styling

Root: arc

Anchors

Supports border and path anchors.

arc-start
The position at which the arc’s curve starts, this is the default.
arc-end
The position of the arc’s curve end.
arc-center
The midpoint of the arc’s curve.
center
The center of the arc, this position changes depending on if the arc is closed or not.
chord-center
Center of chord of the arc drawn between the start and end point.
origin
The origin of the arc’s circle.
arc((0,0), start: 45deg, stop: 135deg)
arc((0,-0.5), start: 45deg, delta: 90deg, mode: "CLOSE")
arc((0,-1), stop: 135deg, delta: 90deg, mode: "PIE")

position:

Position to place the arc at.

start:

The angle at which the arc should start. Remember that 0deg points directly towards the right and 90deg points up.

stop:

The angle at which the arc should stop.

delta:

The change in angle away start or stop.

name:

none or str

anchor:

none or str

..style:

radius:

Default: 1

The radius of the arc. An elliptical arc can be created by passing a tuple of numbers where the first element is the x radius and the second element is the y radius.

mode:

Default: "OPEN"

The options are: "OPEN" no additional lines are drawn so just the arc is shown; "CLOSE" a line is drawn from the start to the end of the arc creating a circular segment; "PIE" lines are drawn from the start and end of the arc to the origin creating a circular sector.

update-position:

Default: true

Update the current canvas position to the arc’s end point (anchor "arc-end"). This overrides the default of true, that allows chaining of (arc) elements.

arc-through

arc-through() 

Draws an arc that passes through three points a, b and c.

Note that all three points must not lie on a straight line, otherwise the function fails.

Styling

Root: arc
Uses the same styling as arc.

Anchors

For anchors see arc.

let (a, b, c) = ((0, 1), (2, 2), (2, 0))

// Draw an arc through 3 points
arc-through(a, b, c)

// Show the points
set-style(content: (frame: "circle", padding: 1pt, fill: white))
content(a, [A]); content(b, [B]); content(c, [C])

Start position of the arc

Position the arc passes through

End position of the arc

name:

none or str

..style: