21 lines
614 B
Python
Executable File
21 lines
614 B
Python
Executable File
import math
|
|
from Program import Program
|
|
from Command import Command
|
|
|
|
from hilbertcurve.hilbertcurve import HilbertCurve
|
|
penthickness=28
|
|
|
|
def hilbert( laenge, dicke):
|
|
tiefe=math.floor(math.log(laenge/dicke,2)+3)
|
|
print("Tiefe",tiefe)
|
|
hilbert_curve = HilbertCurve(tiefe , 2)
|
|
pts = [hilbert_curve.coordinates_from_distance(i) for i in range(4*(2**tiefe))]
|
|
return pts
|
|
|
|
def hilbert_curve(plt):
|
|
|
|
list=hilbert(min(plt.winsize[0],plt.winsize[1]),penthickness)
|
|
return Program([Command('IN'),Command('SP1'),Command('PU',*list[0])]\
|
|
+[Command('PD',*p) for p in list[1:]]\
|
|
+[Command('PU')])
|