How do I draw a segment of a circle?

You can use the arc function.
Here is an example:

#let circle-segment(start, stop) = canvas({
  import draw: *

  let arc-color = rgb("#76BDE9")
    
    //Draw the blue circle segment in three parts/lines/strokes
    merge-path(
      fill: arc-color,
      stroke: none,
      {
      line((0,0), (start, 1))
      arc((0,0), start: start, stop: stop, anchor: "origin")
      line((0,0), (stop, 1))
    })

    //Draw the black start and stop lines
    line((0,0), (start, 1.3))
    line((0,0), (stop, 1.3))
})

The result could look something like this:
https://typst.app/project/rwkY7GDDuI8iy8QXzanAF2

3 Likes