Haven't tried this but worth a closer inspection. Anyone else wants to be a class buddy?
https://www.kadenze.com/courses/computing-form-and-shape-python-programming-with-the-rhinoscript-library/info
bic
@bic
Best posts made by bic
-
Kadenze online course
Latest posts made by bic
-
RE: Voronoi Fun
@gferreira Thanks! I was actually trying to generate a custom sized eps. Maybe this is the wrong approach. Matplotlib generates something similar very easily with the scipy.spatial libary...but ugly....
-
RE: Voronoi Fun
Ok, maybe I need a bit more assistance. Not sure how the PIL library codes can be translated to drawbot's methods of creating images.
https://rosettacode.org/wiki/Voronoi_diagram#PythonThis the the sample code I'm trying to translate to Drawbot:
from PIL import Image import random import math def generate_voronoi_diagram(width, height, num_cells): image = Image.new("RGB", (width, height)) putpixel = image.putpixel imgx, imgy = image.size nx = [] ny = [] nr = [] ng = [] nb = [] for i in range(num_cells): nx.append(random.randrange(imgx)) ny.append(random.randrange(imgy)) nr.append(random.randrange(256)) ng.append(random.randrange(256)) nb.append(random.randrange(256)) for y in range(imgy): for x in range(imgx): dmin = math.hypot(imgx-1, imgy-1) j = -1 for i in range(num_cells): d = math.hypot(nx[i]-x, ny[i]-y) if d < dmin: dmin = d j = i putpixel((x, y), (nr[j], ng[j], nb[j])) image.save("VoronoiDiagram.png", "PNG") image.show() generate_voronoi_diagram(500, 500, 25)
-
Voronoi Fun
I'm translating some existing codes to Drawbot to generate custom Voronoi SVG, and am looking for suggestions. I'm starting with bezier paths or polygons. What would you use? (Don't give away the answer yet! I may still ask for more help later in the week.)
-
RE: Zip not supported?
Still can't quite pin point what the issue is. Your snippet of code seems to work in both.
Another issue: emoji! (Why did I venture down this rabbit hole.)
Emoji seems to function differently across different IDE. The same script that works greats in Drawbot is in Sublime.Also was trying to count emojis in Drawbot.
from collections import Counters
-
Zip not supported?
Is the "zip" function not supported in Drawbot? Seems to work in Sublime.
-
Kadenze online course
Haven't tried this but worth a closer inspection. Anyone else wants to be a class buddy?
https://www.kadenze.com/courses/computing-form-and-shape-python-programming-with-the-rhinoscript-library/info