ntech
Junior Member
Posts: 99
|
Post by ntech on Feb 19, 2020 2:35:10 GMT
This optical illusion is pretty nice, let's see who can be the first to remake it in JustBasic.
|
|
|
Post by B+ on Feb 19, 2020 3:43:23 GMT
I did this a year and a month ago in another Basic, here is snapshot of translation to JB v2 matching your colors and rings: Another with different colors and more circles... Here is one if we had PAINT Attachments:
|
|
ntech
Junior Member
Posts: 99
|
Post by ntech on Feb 19, 2020 16:05:33 GMT
Awesome, I'd love to see the code.
|
|
|
Post by B+ on Feb 19, 2020 17:03:40 GMT
Awesome, I'd love to see the code. You show me yours, I'll show you mine ;-)) Meanwhile maybe someone might want to take a shot at this? I will give it 3 days, OK?
|
|
|
Post by Rod on Feb 19, 2020 18:59:32 GMT
Place home turn go turn go turn go turn go place repeat
|
|
|
Post by zzz000abc on Feb 19, 2020 19:07:30 GMT
This optical illusion is pretty nice, let's see who can be the first to remake it in JustBasic. logic is simple until you reach first square go on putting one more following circular path do it n times
|
|
|
Post by Rod on Feb 19, 2020 19:44:32 GMT
Well this was a dud! Now need to look much more closely at the angles and spacing. I think I can already see that each starting angle is the inverse of the previous circle.
nomainwin WindowWidth = 800 WindowHeight = 800 UpperLeftX = int((DisplayWidth-WindowWidth)/2) UpperLeftY = int((DisplayHeight-WindowHeight)/2) midx=int(WindowWidth/2) midy=int(WindowHeight/2)
open "Optic" for graphics_nsb as #1 #1 "trapclose [quit]" #1 "down ; fill black" #1 "color white"
for m= 200 to 20 step -40 for n= 1 to 360 step 15 x=midx-(m*sin(n/57.29577951)) y=midy-(m*cos(n/57.29577951)) #1 "set ";x;" ";y #1 "north ;turn ";m;";turn 90;go 10;turn 90;go 10;turn 90;go 10;turn 90 ;go 10" next next wait
[quit] close #1 end
|
|
|
Post by B+ on Feb 19, 2020 22:49:58 GMT
Oh Thanks Rod, you gave me an idea and I reduced my 54 line program down to 20.
Hint: don't try to put same amount of boxes around each circle, consider how to space them evenly and the same amount of space (or nearly so) for each circle plus always have odd amount so it alternates light, dark, light.... all the way around, wait maybe even amount.... ;-)) yeah easy, just consider 2 boxes light, dark and you are back to light, so you need an even amount of boxes.
|
|
|
Post by tsh73 on Feb 20, 2020 7:36:24 GMT
I'm in
|
|
|
Post by tenochtitlanuk on Feb 20, 2020 10:24:54 GMT
A rapid version of one of my website projects. I got a bit sidetracked onto colour fill ( Liberty only) and different shapes. ( the squares one gives the best optical illusion it seems.) Image is two versions.. composite of original spiral version and experiments with bats!!
|
|
|
Post by zzz000abc on Feb 20, 2020 11:58:24 GMT
Hi, here is the more genarelised solution taking part of the solution (drawing squares )from Rod's and following instructions fo B+. you can change the arrangement by changing values of n,j,s, and r .
dw=DisplayWidth:WindowWidth=dw dh=DisplayHeight:WindowHeight=dh open "abc" for graphics as #1 #1,"home;down;posxy x0 y0" #1,"fill 150 150 150" pi=atn(1)*4 :s=15 for j=1 to 8 n=15*j:t=int(360/n) for i=0 to 360-t step t c=pi*i/180:r=j*50 #1,"color 220 220 220" if (i/t) mod 2=0 then #1,"color 0 0 0" x=x0+r*cos(c):y=y0+r*sin(c) #1 "set ";x;" ";y #1 "north ;turn ";i+20;";turn 90;go ";s;";turn 90;go ";s;";turn 90;go ";s;";turn 90 ;go ";s;"" next next wait close #1
|
|
|
Post by B+ on Feb 20, 2020 16:05:56 GMT
I kind of thought tsh73 would get it because he has shown us a crucial calculation earlier for determining number of steps needed to fill a circumference. Hi John, the bats are cool! Are you alternating tilts every other ring? Hi zzz000abc, alternate tilts every other ring and you've got it too! Here I add one line after j = and mod i+? after turning North. (see screen shot: Oh! adjust n if odd so won't get 2 black or two white boxes adjacent to each other. Oh! need to work with circumference calculation divide that not just use a multiple of the ring number, THEN adjust n to even number.) But at present yours does offer a kind of spiral illusion! Attachments:
|
|
|
Post by B+ on Feb 20, 2020 17:22:44 GMT
OK oblong objects don't work as well as regular polys:
|
|