Navigation

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

    Topics created by kalle

    • kalle

      Once more: plot a single point
      General Discussion • • kalle  

      4
      0
      Votes
      4
      Posts
      11
      Views

      kalle

      @frederik the solution of Fredrik is indeed megabit faster... In the meantime (yesterday) I found another fix by using the python pillow environment. It works even faster than the solution of Frederic. Anyway it is strange that Drawbot does not offer a simple plot(x,y) statement xscreen = 640 yscreen = 480 picname ="Feigenbaum.png" newPage(xscreen,yscreen) # Definitions for the pillow environment import math from PIL import Image, ImageDraw colour = (255, 255, 255) #white im = Image.new("RGB", (xscreen, yscreen), colour) draw = ImageDraw.Draw(im) # -------------------------------------- def f(p, k) : fwert = p + k * p * (1 - p) return fwert def input(): global left, right, bottom, top global invisible, visible left = 1.8 right = 3.0 bottom = 0.0 top = 1.5 invisible = 200 visible = 200 def setup(): input() feigenbaumIteration() # Show picture and save picture pillow environment im.show() im.save(picname) def setglobalpoint(xw, yw): size = randint(1,1) middle = randint(-1,1) x = (xw - left) * xscreen / (right - left) y = (yw - bottom) * yscreen / (top - bottom) # point statement of pillow environment draw.point([(x, yscreen - y)], fill="black") def feigenbaumIteration(): deltaxPerPixel = (right - left) / xscreen for section in range(0, xscreen+1, 1): coupling = left + section * deltaxPerPixel population = 0.3 for i in range(0, invisible+1, 1): population = f(population, coupling) for i in range(0, visible+1, 1): setglobalpoint(coupling, population) population = f(population, coupling) setup()
    • kalle

      plot a single point how?
      General Discussion • • kalle  

      3
      0
      Votes
      3
      Posts
      8
      Views

      frederik

      an example with a lot of random points p = BezierPath() for i in range(5000): x = random() * width() y = random() * height() p.moveTo((x, y)) p.lineTo((x, y)) strokeWidth(10) lineCap("round") stroke(0) drawPath(p)