threejs-worldgen
    Preparing search index...

    Function subdivideBlock

    • Splits a block polygon into lots by recursive oriented-bounding-box subdivision (Vanegas et al. 2012): cut across the long axis of each piece's minimum box near its middle, preferring cuts that leave both halves with street frontage, until pieces reach the target area. Slivers (thinner than half the target width, or tiny) are dropped, so lot areas always sum to at most the block area.

      Parameters

      • polygon: Vec2[]

        Block outline, counter-clockwise; every edge is treated as street frontage.

      • target: LotTarget | ((x: number, z: number) => LotTarget)

        Lot size, fixed or looked up at each piece's centroid (so districts can change mid-block).

      • rand: () => number

        Random numbers in [0, 1) (for split jitter).

      • jitter: number = 0.35

        0 = always cut in the middle, 1 = anywhere between 25 % and 75 %.

      • block: number = 0
      • firstId: number = 0

      Returns Lot[]