Author Topic: Crop Circles  (Read 6798 times)

0 Members and 1 Guest are viewing this topic.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Crop Circles
« Reply #15 on: January 26, 2021, 01:59:01 pm »
Dav,

Mr. Warhol would be jealous...

J
Logic is the beginning of wisdom.

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Crop Circles
« Reply #16 on: January 26, 2021, 03:19:01 pm »
Nice, bplus, it looks very much like Romanesco broccoli

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Crop Circles
« Reply #17 on: January 26, 2021, 03:57:05 pm »
Nice, bplus, it looks very much like Romanesco broccoli


Stop encouraging him, Vince.Now he'll code it with cheese saucers.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Crop Circles
« Reply #18 on: January 26, 2021, 05:13:49 pm »
Thanks @vince, I had to remind myself that fractal veggie.

@Pete well cheese doesn't fly but flying cups, bowls, pans, egg timers or blenders, hmm... ;-)


Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Crop Circles
« Reply #19 on: January 26, 2021, 05:18:02 pm »
Flying blenders? Well, like the priest said, who visited Steve's farm... Holy Crop!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Marked as best answer by bplus on January 26, 2021, 03:18:06 pm

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Crop Circles
« Reply #20 on: January 26, 2021, 06:37:50 pm »
Oh look what the blender dragged in:
Code: QB64: [Select]
  1. _TITLE "Crop Circles #3 Mod 2 Blender" 'b+ trans and mod to QB64 2021-01-25
  2.  
  3. CONST Xmax = 1024, Ymax = 730, Cx = Xmax / 2, Cy = Ymax / 2, nCrops = 4
  4. SCREEN _NEWIMAGE(Xmax, Ymax, 32)
  5. _DELAY .25
  6. REDIM SHARED LowColr AS _UNSIGNED LONG, HighColr AS _UNSIGNED LONG, cNum AS LONG
  7. HighColr = _RGB32(240, 220, 80): LowColr = _RGB32(100, 50, 10)
  8. crop0
  9.     _PUTIMAGE , CCircle, 0
  10.     WHILE _MOUSEINPUT: WEND 'aim with mouse
  11.     mx = _MOUSEX: my = _MOUSEY: mb = _MOUSEBUTTON(1)
  12.     drawShip mx, my, LowColr
  13.     IF mb THEN
  14.         PLC mx, my, Cx, Cy, 360
  15.         _DISPLAY
  16.         _DELAY .2
  17.         FlagChange = -1
  18.     END IF
  19.     IF FlagChange THEN
  20.         IF RND < .5 THEN
  21.             crop3
  22.         ELSE
  23.             cNum = (cNum + 1) MOD nCrops
  24.             SELECT CASE cNum
  25.                 CASE 0: crop0
  26.                 CASE 1: crop1
  27.                 CASE 2: crop2
  28.                 CASE 3: crop3
  29.             END SELECT
  30.         END IF
  31.         FlagChange = 0
  32.     END IF
  33.     _DISPLAY
  34.  
  35. 'crop0 uses this
  36. SUB drawc (mx, my)
  37.     cr = .5 * SQR((Cx - mx) ^ 2 + (Cy - my) ^ 2): m = .5 * cr
  38.     dx = (mx - Cx) / m: dy = (my - Cy) / m: dr = cr / m
  39.     FOR i = m TO 0 STEP -1
  40.         IF i MOD 2 = 0 THEN cc = HighColr ELSE cc = LowColr
  41.         x = Cx + dx * (m - i): y = Cy + dy * (m - i): r = dr * i
  42.         fcirc x, y, r, cc
  43.     NEXT
  44.  
  45. SUB fcirc (CX AS LONG, CY AS LONG, R AS LONG, C AS _UNSIGNED LONG)
  46.     DIM Radius AS LONG, RadiusError AS LONG
  47.     DIM X AS LONG, Y AS LONG
  48.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  49.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  50.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  51.     WHILE X > Y
  52.         RadiusError = RadiusError + Y * 2 + 1
  53.         IF RadiusError >= 0 THEN
  54.             IF X <> Y + 1 THEN
  55.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  56.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  57.             END IF
  58.             X = X - 1
  59.             RadiusError = RadiusError - X * 2
  60.         END IF
  61.         Y = Y + 1
  62.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  63.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  64.     WEND
  65.  
  66. SUB PLC (baseX, baseY, targetX, targetY, targetR) ' PLC for PlasmaLaserCannon
  67.     r = RND ^ 2 * RND: g = RND ^ 2 * RND: b = RND ^ 2 * RND: hp = _PI(.5) ' red, green, blue, half pi
  68.     ta = _ATAN2(targetY - baseY, targetX - baseX) ' angle of target to cannon base
  69.     dist = _HYPOT(targetY - baseY, targetX - baseX) ' distance cannon to target
  70.     dr = targetR / dist
  71.     FOR r = 0 TO dist STEP .25
  72.         x = baseX + r * COS(ta)
  73.         y = baseY + r * SIN(ta)
  74.         c = c + .3
  75.         fcirc x, y, dr * r, _RGB32(128 + 127 * SIN(r * c), 128 + 127 * SIN(g * c), 128 + 127 * SIN(b * c))
  76.     NEXT
  77.     FOR rr = dr * r TO 0 STEP -.5
  78.         c = c + 1
  79.         LowColr = _RGB32(128 + 127 * SIN(r * c), 128 + 127 * SIN(g * c), 128 + 127 * SIN(b * c))
  80.         fcirc x, y, rr, LowColr
  81.     NEXT
  82.     cAnalysis LowColr, rr, gg, bb, aa
  83.     HighColr = _RGB32(255 - rr, 255 - gg, 255 - bb)
  84.  
  85. ' PLC uses this
  86. SUB cAnalysis (c AS _UNSIGNED LONG, outRed, outGrn, outBlu, outAlp)
  87.     outRed = _RED32(c): outGrn = _GREEN32(c): outBlu = _BLUE32(c): outAlp = _ALPHA32(c)
  88.  
  89. SUB drawShip (x, y, colr AS _UNSIGNED LONG) 'shipType     collisions same as circle x, y radius = 30
  90.     STATIC ls
  91.     DIM light AS LONG, r AS LONG, g AS LONG, b AS LONG
  92.     r = _RED32(colr): g = _GREEN32(colr): b = _BLUE32(colr)
  93.     fellipse x, y, 6, 15, _RGB32(r, g - 120, b - 100)
  94.     fellipse x, y, 18, 11, _RGB32(r, g - 60, b - 50)
  95.     fellipse x, y, 30, 7, _RGB32(r, g, b)
  96.     FOR light = 0 TO 5
  97.         fcirc x - 30 + 11 * light + ls, y, 1, _RGB32(ls * 50, ls * 50, ls * 50)
  98.     NEXT
  99.     ls = ls + 1
  100.     IF ls > 5 THEN ls = 0
  101.  
  102. ' drawShip needs
  103. SUB fellipse (CX AS LONG, CY AS LONG, xr AS LONG, yr AS LONG, C AS _UNSIGNED LONG)
  104.     IF xr = 0 OR yr = 0 THEN EXIT SUB
  105.     DIM x AS LONG, y AS LONG
  106.     w2 = xr * xr: h2 = yr * yr: h2w2 = h2 * w2
  107.     LINE (CX - xr, CY)-(CX + xr, CY), C, BF
  108.     DO WHILE y < yr
  109.         y = y + 1
  110.         x = SQR((h2w2 - y * y * w2) \ h2)
  111.         LINE (CX - x, CY + y)-(CX + x, CY + y), C, BF
  112.         LINE (CX - x, CY - y)-(CX + x, CY - y), C, BF
  113.     LOOP
  114.  
  115. FUNCTION rand (low, high)
  116.     rand = RND * (high - low) + low
  117.  
  118.  
  119. SUB crop0
  120.     IF CCircle THEN _FREEIMAGE CCircle
  121.     CCircle = _NEWIMAGE(_WIDTH, _HEIGHT, 32)
  122.     _DEST CCircle
  123.     COLOR , HighColr
  124.     CLS
  125.     n = 12: stp = -40
  126.     FOR br = 360 TO 0 STEP stp
  127.         shft = shft + 720 / (n * n)
  128.         FOR i = 1 TO n
  129.             x = Cx + br * COS(_D2R(i * 360 / n + shft))
  130.             y = Cy + br * SIN(_D2R(i * 360 / n + shft))
  131.             drawc x, y
  132.         NEXT
  133.     NEXT
  134.     _DEST 0
  135.  
  136. SUB crop1
  137.     IF CCircle THEN _FREEIMAGE CCircle
  138.     CCircle = _NEWIMAGE(_WIDTH, _HEIGHT, 32)
  139.     _DEST CCircle
  140.     COLOR , HighColr
  141.     CLS
  142.     ga = 137.5: bn = 800
  143.     br = 9.5: lr = .5: r = br: dr = (br - lr) / bn
  144.     hc = 180: lc = 120: cr = (hc - lc) / bn
  145.     FOR n = 1 TO bn
  146.         x = Cx + 10 * SQR(n) * COS(_D2R(n * ga))
  147.         y = Cy + 10 * SQR(n) * SIN(_D2R(n * ga))
  148.         r = r - dr
  149.         fcirc x, y, r, LowColr
  150.     NEXT
  151.     _DEST 0
  152.  
  153. SUB crop2
  154.     IF CCircle THEN _FREEIMAGE CCircle
  155.     CCircle = _NEWIMAGE(_WIDTH, _HEIGHT, 32)
  156.     _DEST CCircle
  157.     'this needs big constrast of color
  158.     HighColr = _RGB32(RND * 80, RND * 80, RND * 80) ' field
  159.     LowColr = _RGB32(175 + RND * 80, 175 + RND * 80, 175 + RND * 80)
  160.     COLOR , HighColr
  161.     CLS
  162.     FOR i = 45 TO Xmax STEP 50
  163.         LINE (i, 0)-(i + 10, Ymax), LowColr, BF
  164.         LINE (0, i)-(Xmax, i + 10), LowColr, BF
  165.     NEXT
  166.     FOR y = 50 TO 650 STEP 50
  167.         FOR x = 50 TO Xmax STEP 50
  168.             fcirc x, y, 10, LowColr
  169.         NEXT
  170.     NEXT
  171.     _DEST 0
  172.  
  173. SUB crop3
  174.     IF CCircle THEN _FREEIMAGE CCircle
  175.     CCircle = _NEWIMAGE(_WIDTH, _HEIGHT, 32)
  176.     _DEST CCircle
  177.     COLOR , HighColr
  178.     CLS
  179.  
  180.     r0 = rand(1, 5) / 5: r1 = rand(1, 5) / 10: r2 = rand(1, 5) / 10
  181.     fc = rand(1, 200) / 10: st = rand(10, 500) / 1000
  182.     xol = 0
  183.     yol = 0
  184.     mol = 0
  185.     FOR i = 0 TO 120 STEP st
  186.         a0 = (i / r0) * (2 * _PI)
  187.         a1 = ((i / r1) * (2 * _PI)) * -1
  188.         x1 = Cx + (SIN(a0) * ((r0 - r1) * fc)) * 30
  189.         y1 = Cy + (COS(a0) * ((r0 - r1) * fc)) * 30
  190.         x2 = x1 + (SIN(a1) * ((r2) * fc)) * 30
  191.         y2 = y1 + (COS(a1) * ((r2) * fc)) * 30
  192.         IF mol = 0 THEN
  193.             mol = 1
  194.             xol = x2
  195.             yol = y2
  196.         ELSE
  197.             LINE (xol, yol)-(x2, y2), LowColr
  198.             xol = x2
  199.             yol = y2
  200.         END IF
  201.     NEXT
  202.  
  203.  
  204.     _DEST 0
  205.  
  206.  

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Crop Circles
« Reply #21 on: January 26, 2021, 07:28:18 pm »
I remember seeing one of these fresh at a local farmer's market and I had to buy it.  It was the most beautiful thing ever.  Screw gifting flowers, imagine receiving one of these for a change.

I ate it raw like broccoli and it tasted like crap, compared to broccoli it's very hard and is relatively tasteless but whatever taste there is it's not very good, I ate the entire thing anyway (not at once).  Maybe it's better cooked?
20170923_180342.jpg
* 20170923_180342.jpg (Filesize: 511.59 KB, Dimensions: 857x711, Views: 178)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Crop Circles
« Reply #22 on: January 26, 2021, 08:15:24 pm »
Quote
Screw gifting flowers, imagine receiving one of these for a change.

Sure and Valentine's Day is coming soon!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Crop Circles
« Reply #23 on: January 26, 2021, 08:19:53 pm »
It was all fun and games, until I had to stop to count Steve's damn dots!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Crop Circles
« Reply #24 on: January 26, 2021, 08:54:30 pm »
It was all fun and games, until I had to stop to count Steve's damn dots!

Pete

I know just what you mean!

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(xmax, ymax, 32)
  2. _DELAY .25
  3.     _PUTIMAGE , sc&, 0
  4.     FOR y = 50 TO ymax - 50 STEP 50
  5.         FOR x = 50 TO xmax - 50 STEP 50
  6.             fcirc x, y, 10, _RGB32(RND * 40, RND * 40, RND * 40, RND * 40)
  7.         NEXT
  8.     NEXT
  9.     _DISPLAY
  10.     _LIMIT 10
  11.  
  12.  
  13. SUB fcirc (CX AS INTEGER, CY AS INTEGER, R AS INTEGER, C AS _UNSIGNED LONG)
  14.     DIM Radius AS INTEGER, RadiusError AS INTEGER
  15.     DIM X AS INTEGER, Y AS INTEGER
  16.     Radius = ABS(R): RadiusError = -Radius: X = Radius: Y = 0
  17.     IF Radius = 0 THEN PSET (CX, CY), C: EXIT SUB
  18.     LINE (CX - X, CY)-(CX + X, CY), C, BF
  19.     WHILE X > Y
  20.         RadiusError = RadiusError + Y * 2 + 1
  21.         IF RadiusError >= 0 THEN
  22.             IF X <> Y + 1 THEN
  23.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  24.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  25.             END IF
  26.             X = X - 1
  27.             RadiusError = RadiusError - X * 2
  28.         END IF
  29.         Y = Y + 1
  30.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  31.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  32.     WEND
  33.  

Edit: new and maybe improved

« Last Edit: January 26, 2021, 09:00:17 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Crop Circles
« Reply #25 on: January 26, 2021, 11:14:54 pm »
Soon someone is going to write a book about this thread.... and it will be in the paranormal section. o_o

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Crop Circles
« Reply #26 on: January 26, 2021, 11:17:16 pm »
It'll be the Librarian who writes about this. Are crop circles pure art? ... or are they ... simulation of a real thing?! OOooOOOOo

I don't buy what the BBC documentary says, there's something real about crop circles.
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Crop Circles
« Reply #27 on: January 27, 2021, 01:52:36 am »
Yeah I only know some of those designs have captured my imagination.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Crop Circles
« Reply #28 on: January 27, 2021, 11:27:44 am »
I had something that captured my imagination once, but my wife refused to pay the ransom to get it back. Hey, two dollars is two dollars.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/