def split

bend-visgraph@2.0.0.0 · visgraph.bend:773

import bend-visgraph@2.0.0.0/visgraph.bend as Visgraph
import Base

773# The sweeps of the first `count` points of `pts`, as two halves of equal
774# work in parallel, `depth` times over. `len` and `cu` are `pts`'s length
775# and `count` as U32; they only place the cut.
776def split(depth: Nat, +g: Visibility, +dir: Direction, +k: Weight, +lo: F32, +hi: F32, +limit: Nat, +pts: Pts, +len: U32, +cu: U32, +count: Nat) -> Edges:
777  match depth:
778    case 0n:
779      sweeps(pts, count, g, dir, k, lo, hi, limit)
780    case 1n++d:
781      +c1u = first_half(g, len, cu)
782      +c1 = Nat.min(count, U32.to_nat(c1u))
783      a b = split(d, g, dir, k, lo, hi, limit, pts, len, c1u, c1) split(d, g, dir, k, lo, hi, limit, drop(c1, pts), (len - c1u : U32), (cu - c1u : U32), Nat.sub(count, c1))
784      EJoin{a, b}

Uses (15)

Used by (1)