Hello @MagnusLundevall
Thanks for this interesting question. Please try this approach using comp(v) and sorting the vertices by their pivot.px
version "2022.1"
XPos = comp(v) { all : pivot.px }
SortedXPos =
XPos[sortIndices(XPos)]
const EPS = 0.01
calcNextVertexLoc(positions, i) =
case i < geometry.nVertices:
case abs(positions[i] - positions[0]) < EPS: calcNextVertexLoc(positions, i+1) // check next vertex position
else: positions[i] - positions[0]
else: scope.sx
getSplitPos =
calcNextVertexLoc(SortedXPos, 2)
@StartRule
SplitRecursive -->
split(x) { getSplitPos : Rectangle | ~1 : SplitRecursive }
Rectangle --> color(rand, rand, rand)