Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Solved
    • Unsolved
    • Search
    1. Home
    2. bic
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    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....

      posted in Code snippets
      bic
      bic
    • 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#Python

      This 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)
      
      posted in Code snippets
      bic
      bic
    • 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.)

      posted in Code snippets
      bic
      bic
    • 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
      
      posted in Bugs
      bic
      bic
    • Zip not supported?

      Is the "zip" function not supported in Drawbot? Seems to work in Sublime. 🤐

      posted in Bugs
      bic
      bic
    • 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

      posted in Tutorials
      bic
      bic