• BSP tree to SVG using AWK

    From mike@mike@porkchop.nul to comp.lang.awk on Wed Nov 4 21:16:16 2026
    From Newsgroup: comp.lang.awk

    Hello. Interesting script here (or it was a learning experiance for me).

    Script (a bit too long to post so here's a link instead):

    <https://drive.google.com/file/d/1cpGSxQLpnFCsGZIAxdx5IKRYdcgAhEye/view>

    SGV image created by the script:

    <https://drive.google.com/file/d/1y6KriCdbxkRVWtNFeFg3YGpdJgc4sR2N/view>

    Notes from the script:

    Creates a BSP tree as an SVG image given 2 column input
    where input data is formatted as: NAME|QUANTITY
    2026 Michael S. Sanders

    Here I use...

    Apples|32
    Oranges|16.2
    Bananas|7
    Grapes|3.11
    Pears|8.43
    Mangoes|2
    Kiwi|0.50

    to calculate each fruit's percentage of the total quantity:

    Fruit Quantity Share
    Apples 32 46.22%
    Oranges 16.2 23.40%
    Bananas 7 10.11%
    Grapes 3.11 4.49%
    Pears 8.43 12.18%
    Mangoes 2 2.89%
    Kiwi 0.50 0.72%
    Total 69.24 100.00%

    See also...

    BSP tree: <https://en.wikipedia.org/wiki/Binary_space_partitioning>

    Enjoy.
    --
    :wq
    Mike Sanders
    --- Synchronet 3.22a-Linux NewsLink 1.2