Navigation

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

    Topics created by mrrouge

    • mrrouge

      UNSOLVED Random Lines with no intersection
      General Discussion • randomness • 29 Jun 2019, 18:26 • mrrouge   4 Jul 2019, 08:11

      4
      0
      Votes
      4
      Posts
      449
      Views

      jo 4 Jul 2019, 08:11

      @mrrouge ok if i got you right you want the function to return a value — in your case the height of the legs. this value could then be used in a while loop. while loops are quite helpful but might run forever if done incorrect. I adapted the code a bit so the legs function returns the length of the legs which is then added to the y value in the while loop. There is a check inside the while loop so it will run for a maximum of 3000 times. # ------------- # settings pw = ph = 500 amount_x = 10 cell_w = pw / amount_x max_h = 50 gap = max_h * .2 # ------------- # fucntion(s) def legs(pos, max_w, max_h): x, y = pos length = random() * max_h step_s = random() * max_w polygon((x - step_s, y) , (x, y + length), (x + step_s, y), close = False) return length # ------------- # drawings newPage(pw, ph) fill(None) stroke(0) strokeWidth(2) for x in range(amount_x): count = 0 y = -random() * max_h while y < ph: y += legs((x * cell_w + cell_w/2, y), cell_w/2, max_h) y += gap count += 1 if count > 3000: break and the while loop without the check: for x in range(amount_x): y = -random() * max_h while y < ph: y += legs((x * cell_w + cell_w/2, y), cell_w/2, max_h) y += gap
    • mrrouge

      SOLVED determine centerpoint in irregular rectangle / create "composition"
      General Discussion • geometry • 27 Jun 2019, 18:47 • mrrouge   28 Jun 2019, 07:44

      5
      0
      Votes
      5
      Posts
      355
      Views

      mrrouge 28 Jun 2019, 07:44

      thanks @}->--
    • mrrouge

      SOLVED Hi can somebody help me randomize shapes within a loop ?
      General Discussion • randomness • 26 Jun 2019, 18:25 • mrrouge   27 Jun 2019, 18:33

      3
      0
      Votes
      3
      Posts
      302
      Views

      mrrouge 27 Jun 2019, 18:33

      Cool thanks for your help ! Iam really struggling to find the right information in the reference
    • mrrouge

      SOLVED Moving Anchor point of a Primitive to its middle ?
      General Discussion • transformations geometry • 16 Jun 2019, 10:38 • mrrouge   16 Jun 2019, 13:35

      3
      0
      Votes
      3
      Posts
      346
      Views

      mrrouge 16 Jun 2019, 13:35

      thanks a lot
    Drawing With Python