neg exp
This commit is contained in:
parent
4037d0ac36
commit
698e9b9f67
1 changed files with 13 additions and 8 deletions
21
golnaz.py
21
golnaz.py
|
@ -41,7 +41,7 @@ class Example(Gtk.Window):
|
|||
def on_draw(self, wid, cr):
|
||||
stroke_size = 8
|
||||
line_factor = 1/8
|
||||
iterations = 1000
|
||||
iterations = 10
|
||||
w, h = self.get_size()
|
||||
|
||||
cr.set_line_width(stroke_size)
|
||||
|
@ -62,7 +62,7 @@ class Example(Gtk.Window):
|
|||
stroke_size = 1
|
||||
cr.set_line_width(1)
|
||||
#qui il for delle linee sopr
|
||||
drawBlackArea(cr,w,1,10)
|
||||
# drawBlackArea(cr,w,1,10)
|
||||
drawLines(cr, w, h,1, iterations)
|
||||
cr.restore()
|
||||
|
||||
|
@ -72,15 +72,20 @@ class Example(Gtk.Window):
|
|||
cr.translate(0, -stroke_size/2)
|
||||
stroke_size = 1
|
||||
cr.set_line_width(1)
|
||||
drawBlackArea(cr,w,-1,10)
|
||||
# drawBlackArea(cr,w,-1,10)
|
||||
drawLines(cr, w, h, -1, iterations)
|
||||
|
||||
def drawLines(cr,w, h, direction, iterations):
|
||||
for l in range(0,iterations):
|
||||
cr.translate(0, direction * 1.05**l)
|
||||
perc_partition = 20
|
||||
upper_bound = (int)(iterations*perc_partition/100)
|
||||
lower_bound = upper_bound - iterations
|
||||
print(str(lower_bound) + " -> " + str(upper_bound))
|
||||
for l in range(lower_bound,upper_bound):
|
||||
# cr.translate(0, direction * 1.05**l)
|
||||
cr.translate(0, direction * 2.7**l)
|
||||
cr.move_to(0,0)
|
||||
# cr.line_to(w,0)
|
||||
drawSegmentedLine(cr,w,l)
|
||||
# cr.line_to(w,0)
|
||||
drawSegmentedLine(cr,w,l+upper_bound)
|
||||
cr.stroke()
|
||||
|
||||
def drawBlackArea(cr,w, direction, iterations):
|
||||
|
@ -98,7 +103,7 @@ def drawSegmentedLine(cr,w,currIt):
|
|||
for l in range(rv,0, -1):
|
||||
lw = wresiduo/l
|
||||
lw = lw + random.uniform(-5,5)
|
||||
deltaY = random.uniform(-currIt,currIt)
|
||||
deltaY = random.uniform(-currIt*0.3,currIt*0.3)
|
||||
cr.move_to(0,0)
|
||||
cr.line_to(lw,deltaY)
|
||||
cr.stroke()
|
||||
|
|
Loading…
Reference in a new issue