### Author Topic: Connett Circles  (Read 603 times)

#### B+

• Full Member
• Posts: 215
##### Connett Circles
« on: September 17, 2016 »
http://shawweb.myzen.co.uk/stephen/sdlbasic.htm

Code: [Select]
'patterns.txt Naalaa [B+=MGA] from
'pattern.bas for SmallBASIC 0.12.0 2015-11-27 Peter W & MGA/B+
'pixel colorized version
constant:
xmax = 800
ymax = 600
hidden:
set window 100, 40, xmax, ymax
set redraw false

s# = 500.0
while 1
set colori 0xffffff
cls
set colori 0
for y = 0 to ymax
for x = 0 to xmax
a# = float(x) * s / 600.0
b# = float(y) * s / 600.0
c# = a# * a# + b# * b#
d# = c# / 2.0
d# = d# - float(int(d#))
if d# < 0.25
r = int(d# * 4.0 * 255.0)
set color r, 0, 0
elseif d# < 0.5
g = int(d# * 2.0 * 255.0)
set color 0, g, 0
elseif d# < 0.75
bl = int(d# * 4.0 / 3.0 * 255.0)
set color 0, 0, bl
else
set color 0, 0, 0
endif
draw pixel x, y
next
next
redraw
wait 200
if keydown(27, true) then end
s# = s# + 5.0
if s# > 1000.0 then s# = 5.0
wend

B+

#### Rick3137

• Sr. Member
• Posts: 347
• May the Force be with You
##### Re: Connett Circles
« Reply #1 on: September 17, 2016 »
Those Connett Circles are cool.    Nice find.

#### Marcus

• Hero Member
• Posts: 549
##### Re: Connett Circles
« Reply #2 on: September 19, 2016 »
Sweet indeed!
.\\\opz

#### B+

• Full Member
• Posts: 215
##### Re: Connett Circles
« Reply #3 on: September 19, 2016 »

Here is another version 8 color ranges. I think the more colors the more fine details.

Something odd is developing on the right side sweeping down from top to  bottom. I guess it's a numbers thing.
Code: [Select]
'patterns 8 color range.txt Naalaa [B+=MGA] from
'pattern.bas for SmallBASIC 0.12.0 2015-11-27 Peter W & MGA/B+
'pixelated colorized version
'2016-09-18 mod fix color range now 6 primary and secondary & B&W

constant:
xmax = 800
ymax = 600
hidden:
set window 100, 40, xmax, ymax
set redraw false

s# = 500.0
while 1
set colori 0xffffff
cls
set colori 0
for y = 0 to ymax
for x = 0 to xmax
a# = float(x) * s / 600.0
b# = float(y) * s / 600.0
c# = a# * a# + b# * b#
d# = c# / 2.0
d# = d# - float(int(d#))
if d# < 0.125
set color 0, 0, 0
elseif d# < 0.25
r = int((d# - 0.125) / 0.125 * 190.0 + 65.0)
set color r, 0, 0
elseif d# < 0.375
r = int((d# - 0.25) / 0.125 * 190.0 + 65.0)
set color r, r, 0
elseif d# < 0.5
g = int((d# - 0.375) / 0.125 * 190.0 + 65.0)
set color 0, g, 0
elseif d# < 0.625
g = int((d# - 0.5) / 0.125 * 190.0 + 65.0)
set color 0, g, g
elseif d# < 0.75
bl = int((d# - 0.625) / 0.125 * 190.0 + 65.0)
set color 0, 0, bl
elseif d# < 0.875
bl = int((d# - 0.75) / 0.125 * 190.0 + 65.0)
set color bl, 0, bl
else
set color 255, 255, 255
endif
draw pixel x, y
next
next
redraw
wait 200
if keydown(27, true) then end
s# = s# + 5.0
if s# > 1000.0 then s# = 5.0
wend
« Last Edit: September 19, 2016 by B+ »
B+