From b24f282bca4af63982937c10835063d3e6e9eb74 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 21 Feb 2016 18:08:55 -0800 Subject: add many, many more example conversions. still not complete --- examples/drawing2d/insert.jl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/drawing2d/insert.jl (limited to 'examples/drawing2d/insert.jl') diff --git a/examples/drawing2d/insert.jl b/examples/drawing2d/insert.jl new file mode 100644 index 0000000..41bb0b9 --- /dev/null +++ b/examples/drawing2d/insert.jl @@ -0,0 +1,32 @@ +# Original Python: +# from math import sin, cos, radians +# from pyx import * + +# angle = 10 +# factor = 1.0 / (cos(radians(angle)) + sin(radians(angle))) + +# cc = canvas.canvas() +# cc.stroke(path.rect(-2, -2, 4, 4)) + +# c = canvas.canvas() +# for i in range(10): +# c.insert(cc, [trafo.rotate(i*angle), trafo.scale(factor**i)]) +# c.writeEPSfile("insert") +# c.writePDFfile("insert") +# c.writeSVGfile("insert") + +using PyX + +angle = 10 +factor = 1.0 / (cos(deg2rad(angle)) + sin(deg2rad(angle))) + +cc = canvas.canvas() +stroke(cc, path.rect(-2, -2, 4, 4)) + +c = canvas.canvas() +for i in 0:9 + pyx_insert(c, cc, [trafo.rotate(i*angle), trafo.scale(factor^i)]) +end + +writeEPSfile(c, "insert") +writePDFfile(c, "insert") -- cgit v1.2.3