This is very complicated to solve as of now. Please create a separate ticket for this. Detecting holes is a contour is currently not supported. We could test if a polygon lies insides another polygon. BUT Typst is currently unable to draw paths with holes in them.
code
```typ
#import "@local/cetz:0.1.2"
#cetz.canvas({
import cetz.draw: *
import cetz.plot
let get-style(color) = {
let (r, g, b, ..) = color.to-rgba()
(line: (stroke: rgb(r, g, b) + 1pt, fill: color.lighten(25%)))
}
let x-min = -10
let x-max = 10
let y-min = -10
let y-max = 10
let width = x-max - x-min
let height = y-max - y-min
plot.plot(size: (15, 15), {
// circle
plot.add-contour(
(x, y) => (calc.pow((x - 1), 2) + calc.pow((y - 1), 2)),
op: ">=",
z: 9,
x-domain: (x-min, x-max),
y-domain: (y-min, y-max),
x-samples: 50,
y-samples: 50,
fill: true,
style: get-style(rgb("#2D6FB47F")), // blue
)
})
})
```
screenshot
![image](https://github.com/johannes-wolf/cetz/assets/37143421/ec9d258f-d25f-4c01-b8c9-e73445612ea1)
When using
x² + y²
+op: ">="
+z: 9
+fill: true
it fills outside the circle and inside of it (although it works as expected with hyperbola).https://github.com/johannes-wolf/cetz/issues/270#issuecomment-1775489607:
code
```typ #import "@local/cetz:0.1.2" #cetz.canvas({ import cetz.draw: * import cetz.plot let get-style(color) = { let (r, g, b, ..) = color.to-rgba() (line: (stroke: rgb(r, g, b) + 1pt, fill: color.lighten(25%))) } let x-min = -10 let x-max = 10 let y-min = -10 let y-max = 10 let width = x-max - x-min let height = y-max - y-min plot.plot(size: (15, 15), { // circle plot.add-contour( (x, y) => (calc.pow((x - 1), 2) + calc.pow((y - 1), 2)), op: ">=", z: 9, x-domain: (x-min, x-max), y-domain: (y-min, y-max), x-samples: 50, y-samples: 50, fill: true, style: get-style(rgb("#2D6FB47F")), // blue ) }) }) ```screenshot
![image](https://github.com/johannes-wolf/cetz/assets/37143421/ec9d258f-d25f-4c01-b8c9-e73445612ea1)This issue was tested against
redesign-internals#742d560
.