|
@@ -4,23 +4,23 @@
|
|
|
Schotter pdf reproduction
|
|
|
|
|
|
It design SchotterR
|
|
|
-Author: Jan Bodnar
|
|
|
-Website: zetcode.com
|
|
|
-Last edited: April 2016
|
|
|
+Author: Luca COnte ''
|
|
|
+Website: polybius.fyi
|
|
|
+Last edited: June 2019
|
|
|
'''
|
|
|
|
|
|
import math,cairo,random
|
|
|
|
|
|
def plotSquares(ctx):
|
|
|
global rsum
|
|
|
- for i in xrange(0,w-1):
|
|
|
-
|
|
|
- rsum += i*rs # add to the random value
|
|
|
- ctx.save()
|
|
|
- ctx.translate(s*i, 0)
|
|
|
- for j in xrange(0,h-1):
|
|
|
+ for i in range(0,w-1):
|
|
|
+ rsum += i*rs # add to the random value
|
|
|
+ ctx.save()
|
|
|
+ ctx.translate(s*i+1.1**i
|
|
|
+*dp, 0)
|
|
|
+ for j in range(0,h-1):
|
|
|
|
|
|
- rv = random.uniform(-rsum, rsum)
|
|
|
+ rv = random.uniform(-rsum, rsum)
|
|
|
# here comes the box :-)
|
|
|
#box = shapes.square(s)
|
|
|
|
|
@@ -30,12 +30,11 @@ def plotSquares(ctx):
|
|
|
#
|
|
|
# # rotate the box of rv degrees around its center
|
|
|
# transforms.rotate(box, rv, pivot=(curr_cx, curr_cy))
|
|
|
- #
|
|
|
# draw the damn box
|
|
|
# plotter.write(box)
|
|
|
#
|
|
|
- ctx.translate(rs*dp*i, s)
|
|
|
#ctx.rotate(math.pi * 1 / 4)
|
|
|
+ ctx.translate(rs*dp*i, s)
|
|
|
ctx.save()
|
|
|
ctx.rotate(rv)
|
|
|
ctx.rectangle(0,0, s, s)
|
|
@@ -50,11 +49,11 @@ FG_RGB_COLOR=(0,0,0)
|
|
|
width, height = 3508,2480
|
|
|
offsetX, offsetY = 100,500
|
|
|
|
|
|
-w = 10 # width (how many squares - es. 22)
|
|
|
+w = 22 # width (how many squares - es. 22)
|
|
|
h = 12 # height (how many squares - es. 12)
|
|
|
s = 100 # square size (es. 15)
|
|
|
|
|
|
-rs = 0.015 # random step (rotation increment in degrees)
|
|
|
+rs = 0.01 # random step (rotation increment in degrees)
|
|
|
dp = 2.25 # dampen (soften random effect for position)
|
|
|
rsum = 0 # dummy initial value for rsum
|
|
|
|