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.
The angle at which the arc should start. Remember that 0deg points directly towards the right and 90deg points up.
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.
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 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])
a:
Start position of the arc
b:
Position the arc passes through
c:
End position of the arc