kopia lustrzana https://github.com/villares/sketch-a-day
Update sketch_2021_06_03c.pyde
rodzic
634dde8f37
commit
f92d50e63f
|
@ -1,32 +1,13 @@
|
|||
from itertools import product, combinations, permutations
|
||||
from random import choice, sample, shuffle
|
||||
from villares.line_geometry import edges_as_sets, poly_area
|
||||
from villares.gif_export import gif_export
|
||||
add_library('gifAnimation')
|
||||
from random import sample
|
||||
|
||||
def setup():
|
||||
global grade, rects
|
||||
size(500, 500)
|
||||
grade = list(product(range(50, 500, 100), repeat=2))
|
||||
frameRate(2)
|
||||
all_polys = permutations(grade, 4)
|
||||
|
||||
t = millis()
|
||||
# tested, polys = set(), []
|
||||
# for poly in all_polys:
|
||||
# edges = edges_as_sets(poly)
|
||||
# if edges not in tested and edges:
|
||||
# tested.add(edges)
|
||||
# polys.append(poly)
|
||||
|
||||
# rects = [p for p in polys if
|
||||
# digonals_equal(p)
|
||||
# ]
|
||||
|
||||
print(millis() - t)
|
||||
# shuffle(rects)
|
||||
# print(len(rects)) # 50 rects
|
||||
|
||||
# all_polys = permutations(grade, 4)
|
||||
|
||||
|
||||
def draw():
|
||||
colorMode(RGB)
|
||||
|
@ -46,23 +27,7 @@ def draw():
|
|||
ab = degrees(atan2(a[1] - b[1], a[0] - b[0]))
|
||||
cd = degrees(atan2(c[1] - d[1], c[0] - d[0]))
|
||||
p = abs(ab - cd)
|
||||
|
||||
|
||||
|
||||
# textAlign(CENTER, CENTER)
|
||||
# if p == 0 or p == 90 or p == 180:
|
||||
# fill(255, 0, 0)
|
||||
# else:
|
||||
# fill(0)
|
||||
# textSize(40)
|
||||
# text(format(p, ".0f"), 250, 200)
|
||||
# text(cd, 250, 290)
|
||||
|
||||
# if frameCount % len(rects) == 0:
|
||||
# gif_export(GifMaker, finish='True')
|
||||
# exit()
|
||||
# else:
|
||||
# gif_export(GifMaker, 'output', delay=400, quality=0)
|
||||
|
||||
|
||||
def lerpPoints(points_a, points_b, t):
|
||||
return [(lerp(a[0], b[0], t),
|
||||
|
|
Ładowanie…
Reference in New Issue