graph LR subgraph "Euclidean (L2)" E1((Site A)) --- E2((Site B)) end subgraph "Manhattan (L1)" M1((Site A)) -.- M2((Site B)) end style E1 fill:#bbdefb,stroke:#1565c0 style E2 fill:#bbdefb,stroke:#1565c0 style M1 fill:#c8e6c9,stroke:#2e7d32 style M2 fill:#c8e6c9,stroke:#2e7d32
graph TB subgraph "|dx| > |dy|: vertical-ish bisector" A1["P1 β"] --- B1["bisector β"] B1 --- C1["P2 β"] end subgraph "|dx| < |dy|: horizontal-ish bisector" A2["P1 β"] --- B2["bisector β"] B2 --- C2["P2 β"] end subgraph "|dx| = |dy|: AMBIGUOUS REGION β οΈ" A3["P1 β"] -.- B3["???"] B3 -.- C3["P2 β"] end style B3 fill:#ffcdd2,stroke:#c62828,stroke-width:3px
graph TD A["All Sites"] --> B["Split by x"] B --> C["Left Half"] B --> D["Right Half"] C --> E["Recurse Left"] D --> F["Recurse Right"] E --> G["Merge Left & Right"] F --> G G --> H["Walk Merge Line\n(upward + downward stroke)"] H --> I["Find Bisector Intersections"] I --> J["Trim Bisectors"] J --> K["Final Voronoi Polygons"] style A fill:#e3f2fd,stroke:#1565c0 style G fill:#fff9c4,stroke:#f9a825,stroke-width:2px style K fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px
graph TB subgraph "Sites on diagonal: P1=(10,10), P2=(90,90)" direction TB P1["P1 β (10,10)"] -- "|dx|=|dy|=80" --> P2["P2 β (90,90)"] end subgraph "Ambiguous Bisector Region π¨" R["All points where\n|x-10|+|y-10| = |x-90|+|y-90|\nis a full REGION"] end P1 -.-> R P2 -.-> R style R fill:#fff9c4,stroke:#f9a825,stroke-width:3px style P1 fill:#bbdefb,stroke:#1565c0 style P2 fill:#bbdefb,stroke:#1565c0
graph LR subgraph "L2 Euclidean β" L2A["Bisector AB"] --> L2P["Concurrent Point β"] L2B["Bisector BC"] --> L2P L2C["Bisector AC"] --> L2P end subgraph "L1 Manhattan β" L1A["Bisector AB"] --> L1P1["Point 1 β"] L1B["Bisector BC"] --> L1P2["Point 2 β"] L1C["Bisector AC"] --> L1P1 L1P1 -.- L1P2 end style L2P fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px style L1P1 fill:#ffcdd2,stroke:#c62828 style L1P2 fill:#ffcdd2,stroke:#c62828
graph TB subgraph "Geometry" direction LR A1["A (-4,4) β"] -- "|dx|=|dy|=3" --> B1["B (-1,1) β"] A1 -- "bisector AC" --> C1["C (-8,-2) β"] B1 -- "bisector BC" --> C1 end subgraph "With up=True (correct) β" AB["bisector AB: vertical at x=6"] ACBC["intersection(AC,BC) = (-4,-1)"] AB --> ACBC end subgraph "With up=False (wrong) β" AB2["bisector AB: horizontal at y=11"] ACBC2["intersection(AC,BC) = (-4,-1)"] AB2 -.- ACBC2 end style ACBC fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px style ACBC2 fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px
graph TD A["Check denom == 0"] --> B{"Cross product\n== 0? (collinear?)"} B -- No --> C["Return None\n(parallel)"] B -- Yes --> D{"Degenerate\nsegment?"} D -- Yes --> C D -- No --> E["1D Project onto\ndominant axis"] E --> F{"Overlap exists?"} F -- No --> C F -- Yes --> G["Scan 4 endpoints,\nreturn one with\nlowest y-coordinate"] G --> H["Return intersection point β"] style H fill:#e8f5e9,stroke:#2e7d32,stroke-width:3px style C fill:#ffcdd2,stroke:#c62828