wip
This commit is contained in:
parent
669d863377
commit
d0903b1bc7
|
@ -26,7 +26,7 @@ PEN_DOWN_SPEED = 150
|
||||||
PEN_DOWN_DELAY = 0
|
PEN_DOWN_DELAY = 0
|
||||||
|
|
||||||
ACCELERATION = 8
|
ACCELERATION = 8
|
||||||
MAX_VELOCITY = 3
|
MAX_VELOCITY = 4
|
||||||
CORNER_FACTOR = 0.005
|
CORNER_FACTOR = 0.005
|
||||||
|
|
||||||
VID_PID = '04D8:FD92'
|
VID_PID = '04D8:FD92'
|
||||||
|
|
|
@ -187,7 +187,6 @@ class Drawing(object):
|
||||||
for angle in range(0, 180, step):
|
for angle in range(0, 180, step):
|
||||||
d = hull.rotate(angle)
|
d = hull.rotate(angle)
|
||||||
scale = min(width / d.width, height / d.height)
|
scale = min(width / d.width, height / d.height)
|
||||||
print angle, d.width, d.height
|
|
||||||
values.append((scale, angle))
|
values.append((scale, angle))
|
||||||
scale, angle = max(values)
|
scale, angle = max(values)
|
||||||
return self.rotate(angle).scale(scale, scale).center(width, height)
|
return self.rotate(angle).scale(scale, scale).center(width, height)
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
import axi
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def prepare():
|
||||||
|
d = axi.Drawing.load(sys.argv[1])
|
||||||
|
print len(d.paths)
|
||||||
|
print 'transforming'
|
||||||
|
d = d.rotate_and_scale_to_fit(12, 8.5)
|
||||||
|
print 'sorting'
|
||||||
|
d = d.sort_paths()
|
||||||
|
print 'joining'
|
||||||
|
d = d.join_paths(0.01)
|
||||||
|
print len(d.paths)
|
||||||
|
print 'simplifying'
|
||||||
|
d = d.simplify_paths(0.005)
|
||||||
|
print 'rendering'
|
||||||
|
im = d.render(
|
||||||
|
scale=109 * 1, line_width=0.3/25.4,
|
||||||
|
)#show_axi_bounds=False, use_axi_bounds=False)
|
||||||
|
im.write_to_png('isolines.png')
|
||||||
|
d.dump('isolines.axi')
|
||||||
|
|
||||||
|
def vertical_stack(ds, spacing=0, center=True):
|
||||||
|
result = axi.Drawing()
|
||||||
|
y = 0
|
||||||
|
for d in ds:
|
||||||
|
x = 0
|
||||||
|
if center:
|
||||||
|
x = -d.width / 2
|
||||||
|
d = d.origin().translate(x, y)
|
||||||
|
result.add(d)
|
||||||
|
y += d.height + spacing
|
||||||
|
return result
|
||||||
|
|
||||||
|
def title():
|
||||||
|
d1 = axi.Drawing(axi.text('Topography of', axi.METEOROLOGY))
|
||||||
|
d1 = d1.scale_to_fit_height(0.25)
|
||||||
|
d2 = axi.Drawing(axi.text('Vancouver Island', axi.METEOROLOGY))
|
||||||
|
d2 = d2.scale_to_fit_height(0.375)
|
||||||
|
d = vertical_stack([d1, d2], 0.125, False)
|
||||||
|
d = d.join_paths(0.01)
|
||||||
|
d = d.simplify_paths(0.001)
|
||||||
|
d = d.move(0, 8.5, 0, 1)
|
||||||
|
return d
|
||||||
|
|
||||||
|
def main():
|
||||||
|
d = axi.Drawing.load(sys.argv[1])
|
||||||
|
d.add(title())
|
||||||
|
im = d.render(
|
||||||
|
scale=109 * 1, line_width=0.3/25.4,
|
||||||
|
show_axi_bounds=False, use_axi_bounds=False)
|
||||||
|
im.write_to_png('out.png')
|
||||||
|
d.dump('out.axi')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# prepare()
|
||||||
|
main()
|
Loading…
Reference in New Issue