aboutsummaryrefslogtreecommitdiffstats
path: root/examples/drawing2d/insert.jl
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-02-21 18:08:55 -0800
committerbnewbold <bnewbold@robocracy.org>2016-02-21 18:08:55 -0800
commitb24f282bca4af63982937c10835063d3e6e9eb74 (patch)
treefd8c58601beb3964ccecf4709f7b28944fc1c36b /examples/drawing2d/insert.jl
parent84572be10cdfc852530787a5dc78ddef3e0f23cd (diff)
downloadPyX.jl-b24f282bca4af63982937c10835063d3e6e9eb74.tar.gz
PyX.jl-b24f282bca4af63982937c10835063d3e6e9eb74.zip
add many, many more example conversions. still not complete
Diffstat (limited to 'examples/drawing2d/insert.jl')
-rw-r--r--examples/drawing2d/insert.jl32
1 files changed, 32 insertions, 0 deletions
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")