Skip to main content

boolean

boolean() 

Performs a boolean operation on the paths produced by two CeTZ bodies. The supported operations are "union", "intersection", "difference", and "xor".

Each operand can either be one or more type:elements or the name of an already-defined element (a string).

All input subpaths must be closed and lie in a single z-plane. The output is a single path drawable in the z-plane of the first input.

Each operand has its own fill-rule, which decides how its self-overlapping or nested subpaths are interpreted as a filled region before the boolean operation runs. By default (auto) the fill-rule is inferred from the operand: if every path drawable produced by the body agrees on one fill-rule (e.g. the body is a single compound-path(..., fill-rule:
"even-odd")
), that value is used; otherwise it falls back to boolean’s own resolved style.

boolean(
{ rect((-1, -1), (1, 0)) },
{ circle((0, 0), radius: 0.8) },
op: "difference",
fill: blue,
)
rect((-1, -1), (1, 0), name: "r")
circle((0, 0), radius: 0.8, name: "c")
boolean("r", "c", op: "difference", fill: blue)

First operand. Either an element body or the name of an existing element.

Second operand. Either an element body or the name of an elementxisting element.

One of "union", "intersection", "difference", "xor".

fill-rule-a:

"non-zero" or "even-odd", applied to a. If auto, inferred from a’s drawables

fill-rule-b:

"non-zero" or "even-odd", applied to b. If auto, inferred from b’s drawables

eps:

Numerical accuracy. auto uses an automatically determined value.

ignore-marks:

Drop marks from the inputs (default: true).

ignore-hidden:

Drop hidden elements from the inputs (default: true).

name:

..style: