2D Graphics
Author 
Message 
kshorting

Posted: Sat Mar 03, 2007 4:17 pm Post subject: 2D Graphics 


In the 1980s, I used my Apple II to run some graphic programs that generated 2D images. I got some interesting results, but they took up to an hour to generate so I packed them away with the computer. When my son loaded Turing onto our home computer last year, I decided to pull these old programs out of mothballs and rewrite them in Turing. I added some code and changed the algorithm and got some entertaining results. I was going to upload a few, but I have to write 25 posts before I am allowed to! Yikes.
So, in the meantime, if anyone is interested, try running the program below. Play with the parameters and see what you get.
Have fun.
KS
setscreen ("graphics")
var a, b, c, f, n ,g,k,t : int
var z, x, y, s, r : real
for l : 5 .. 10 by 5
for m : 14 .. 15 by 1
n := m %number of colors
f := l %field size
c := 1
a := 4
b := 4
s := 1
r := 1
t := 200
for p : 6..6 by 1
for h : 540 .. 540 by 50
for i : 1 .. 200 by 1
t := 201  i
for j : i .. 200 by 1
x := a + ((1 + f/10) * (i  h) / 100 )
y := b + ((1 + f/10) * (j  h) / 100 )
z := p * sin(x*x) + p * sin(y*y)
z := z  n * ceil((z/n))
c := abs(floor( z  (n * floor(z/n)) ))
r := i
s := j
for w : 0..0
r := w + r
s := w + s
r := (floor(sqrt(abs(r*r  s*s)) + a) / 1)
s := floor(2*sqrt(abs(r*s)) + b)
end for
g := floor(r)  22
k := floor(s)
for q : 0..3
drawdot (g + q + 200,i+200, c)
drawdot (g + q + 200,t, c)
drawdot (200  (g  q  0),i+200, c)
drawdot (200  (g  q  0),t, c)
end for
end for
end for
%delay(1000)
end for
end for
end for
end for






Sponsor Sponsor



CodeMonkey2000

Posted: Mon Mar 05, 2007 9:52 pm Post subject: RE:2D Graphics 


Wow this is amazing. I don't understand the logic involved in this, but it's coooool.






kshorting

Posted: Sat Mar 10, 2007 9:10 pm Post subject: Re: 2D Graphics 


Thanks. I'm glad someone else enjoyed this program.
I don't understand the logic that well either, at least not the mathematical background for the formulaes. I got part of the formula from a fractal site. The programs I put together do not create Fractals. True fractal algorithms are far more complex and CPU intensive. I just stole the formula and plugged a version of it in to see what happened. I'm just blindly playing with the parameters and the algebra. I have about 30 or so programs that do more or less the same thing but with different results. I have been trying to get perspective into the mix, but it is rather diffictult to get right. I also put some sound generating code. The results are like musical morse code. Fun, but not exactly party material.
See the attached 3 programs if you are interested. Play with the parameters and see what happens. I find many of the random results beautiful.
KS
Description: 

Download 
Filename: 
patterns9 oddscape 4_2_3.t 
Filesize: 
2.73 KB 
Downloaded: 
124 Time(s) 
Description: 

Download 
Filename: 
patterns9 perspective 4_2_3.t 
Filesize: 
2.73 KB 
Downloaded: 
114 Time(s) 
Description: 

Download 
Filename: 
patterns9 ribbons 4_2_3.t 
Filesize: 
2.74 KB 
Downloaded: 
113 Time(s) 






Banished_Outlaw

Posted: Sat Mar 24, 2007 3:32 pm Post subject: Re: 2D Graphics 


Really Amazing..







