boolean commands - blossommerz/locus-hub GitHub Wiki

Home > Boolean commands

< Previous: Making regions | Next: Reading the node graph >

CLI

Boolean commands

Union, intersect, difference and split, as four commands named for what they take rather than for the menu they sit in.

[!IMPORTANT] Under construction. The CLI is being built, and this page describes work in progress. What it is called, what it can do, and how it behaves are all still moving. Nothing here is a promise about the finished feature.

Why they all start with region-

Because model intersect already means something else. That one makes a point where two objects cross. model region-intersect makes an area where two areas overlap. Different operation, different kind of thing, so the prefix keeps them apart.

What counts as an input

--members takes two or more areas, and an area is any of these:

  • a region you traced, however you made it
  • a circle
  • an ellipse
  • the result of an earlier boolean

Two plain circles are a valid input. You do not have to turn them into regions first.

The four, on the same two shapes

Say you have two overlapping circles, circleL and circleR.

Union

model region-union \
  --members "circleL","circleR" \
  --name "bothTogether"

One area covering everything either circle covers.

Intersect

model region-intersect \
  --members "circleL","circleR" \
  --name "overlapOnly"

One area covering only the part they share.

Difference

model region-difference \
  --members "circleL","circleR" \
  --name "leftMinusRight"

circleL with circleR taken out of it.

Order matters here, and only here. The first member is the one the rest come out of, so swapping the two gives you the other crescent. Union, intersect and split read the list as a set and do not care what order it is in.

Split

model region-split \
  --members "circleL","circleR" \
  --name "allThreePieces"

Split is the odd one out. Instead of one shape it divides the inputs against each other and gives back every face they make between them: here the left-only piece, the overlap, and the right-only piece, as a group of regions rather than a single area.

One thing to know before you start

There is no command that traces a region from scratch out of nothing. Boundaries come from somewhere else first, by one of the three region commands or as a circle or ellipse you already drew.

Related

< Previous: Making regions | Next: Reading the node graph >