Procedural Drawing for Grayscale Height Maps on MS Small Basic
I wrote this basic program for creating some height maps procedurally based on Fibonacci Series, that can be used for 3d modelling or some AI stylizing.
Below image is created from seeds 06 and 12:
And this is the 3D model of it:
Link of code: http://smallbasic.com/program/?TDJF742.000
Code:
zero:
GraphicsWindow.Width=1000GraphicsWindow.Height=800
'Input seeds and step length
' angle seed 1:
TextWindow.Show()
TextWindow.WriteLine("Enter Angle Seed #1 (0-255):")
don1=TextWindow.Read()
' angle seed 2:
TextWindow.WriteLine("Enter Angle Seed #2 (0-255):")
don2=TextWindow.Read()
aci=don2/256*360
renk1= 0
adim=math.Remainder((128+don2/2)/(renk1+1),256)
TextWindow.Hide()
xx=GraphicsWindow.width/2
yy=GraphicsWindow.Height/2
GraphicsWindow.Title="Procedural painter | seeds: "+don1+" & "+don2
GraphicsWindow.BackgroundColor="Black"
'procedure loop
start:
GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(renk1,renk1,renk1)
xx=math.Remainder(xx+GraphicsWindow.Width,GraphicsWindow.Width)
yy=math.Remainder(yy+GraphicsWindow.Height,GraphicsWindow.Height)
GraphicsWindow.FillEllipse(xx,yy,adim+24,adim+24)
don=don1+don2
don1=don2
don2= math.Remainder(don,256)
renk1= renk1 + 0.01
If renk1>255 then
Goto bit
else
EndIf
ex=xx
ey=yy
aci=aci+(don2/16-8)
adim=(256+don2)/(renk1+1)
xx= xx+ adim*Math.Cos(Math.GetRadians(aci))
yy= yy+ adim*Math.Sin(Math.GetRadians(aci))
xx=math.Remainder(xx+GraphicsWindow.Width,GraphicsWindow.Width)
yy=math.Remainder(yy+GraphicsWindow.Height,GraphicsWindow.Height)
GraphicsWindow.FillEllipse(xx,yy,adim+24,adim+24)
don=don1+don2
don1=don2
don2= math.Remainder(don,256)
renk1= renk1 + 0.01
If renk1>255 then
Goto bit
else
EndIf
ex=xx
ey=yy
aci=aci+(don2/16-8)
adim=(256+don2)/(renk1+1)
xx= xx+ adim*Math.Cos(Math.GetRadians(aci))
yy= yy+ adim*Math.Sin(Math.GetRadians(aci))
Goto start
bit:
GraphicsWindow.ShowMessage("Finished!","Message from Turtle")
bekle:
Goto bekle
bit:
GraphicsWindow.ShowMessage("Finished!","Message from Turtle")
bekle:
Goto bekle
Comments
Post a Comment