Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
?xml version="1.0" encoding="iso-8859-1"?>
!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="400pt" height="400pt" viewBox="0 0 400 400">
g fill="none" stroke="blue">
line x1="1" y1="1" x2="1" y2="399" />
line x1="1" y1="399" x2="399" y2="399" />
line x1="399" y1="399" x2="399" y2="1" />
line x1="399" y1="1" x2="1" y2="1" />
line x1="200" y1="1" x2="200" y2="399" />
line x1="1" y1="200" x2="399" y2="200" />
line x1="100" y1="1" x2="100" y2="200" />
line x1="1" y1="100" x2="200" y2="100" />
line x1="50" y1="1" x2="50" y2="100" />
……
復制輸出的結果,命名為 .svg,.html 也行,用瀏覽器打開,會呈現下圖:

圖 5 一個 8*8 大小的點四叉樹區域
看這個圖,從左上角開始,順時針。你可以當做“根據需要,是否要點,不斷按 4 個分裂其中一個方塊”。
下載 Point Qudatree Python 演示