Navigation

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

    kalle

    @kalle

    0
    Reputation
    4
    Posts
    1
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    kalle Follow

    Best posts made by kalle

    This user hasn't posted anything yet.

    Latest posts made by kalle

    • RE: Once more: plot a single point

      @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()
      
      posted in General Discussion
      kalle
      kalle
    • RE: Once more: plot a single point

      @frederik
      Works...
      Great, thank you very much.
      The only thing is that the computer graphics is shown on the screen, but the saved picture on the desktop is empty ?

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

      Re: plot a single point how?

      Hi Frederik, thank you for your clever idea! But sadly to say there is no speed improvement. It is as slow as the oval statement. It is difficult to understand that there is no dedicated command to draw a point. A picture with other python implementations like Thonney Python or Processing Python shows a picture at once.
      So to speak it seems DrawBot is useless for making interesting Computer graphics pictures (Fractals for instance) without the usage of Turtle Graphics. Graphics in an x-y System needs two operations: to draw a point and to draw a line. What a pity that DrawBot is not able to do that ?
      Here is the example with your proposal:
      (As slow as the oval statement to draw a point)
      Best regards (kalle)

      xscreen = 640
      yscreen = 480
      
      newPage(xscreen,yscreen)
      
      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()
          saveImage("~/Desktop/feigenbaum.png")
              
      def setglobalpoint(xw, yw):
          p = BezierPath()
          x = (xw - left) * xscreen / (right - left)
          y = (yw - bottom) * yscreen / (top - bottom)
          #oval(round(x),round(y),1,1)
          #these lines instead of command oval(round(x),round(y),1,1) 
          p.moveTo((x,y))
          p.lineTo((x,y))
          #strokeWidth(1)
          lineCap("round")
          stroke(0)
          drawPath(p)
      
          
      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()
      
      
      posted in General Discussion
      kalle
      kalle
    • plot a single point how?

      There is a line command to plot a line but no command to plot a point. Something like set point(x,y) is not available ? The workaround I use is the command for oval.
      But the effect is that the drawing takes a lot of time...
      😞
      some suggestion to improve would be helpful. EXAMPLE:

      xscreen = 640
      yscreen = 480
      
      newPage(xscreen,yscreen)
      
      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()
          saveImage("~/Desktop/feigenbaum.png")
          
      def setglobalpoint(xw, yw):
          x = (xw - left) * xscreen / (right - left)
          y = (yw - bottom) * yscreen / (top - bottom)
          oval(round(x),round(y),1,1)
          
      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()
      
      posted in General Discussion
      kalle
      kalle