aboutsummaryrefslogtreecommitdiffstats
path: root/examples/drawing2d/insert.jl
blob: 41bb0b928aa7e88fb031643fc02b82824ce83cb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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")