QB4.5 fractel [1989]

General FreeBASIC programming questions.
Post Reply
bluatigro
Posts: 660
Joined: Apr 25, 2012 10:35
Location: netherlands

QB4.5 fractel [1989]

Post by bluatigro »

i found this in a old magazine

experement whit recepy's and report nice one's

i have no idea how many recepy's are out there

Code: Select all

''bluatigro 1 may 2018
''QB4.5 fractel from 1989
const as double pi = atn( 1 ) * 4
const as double golden_ratio = ( sqr( 5 ) - 1 ) / 2
function rad( deg as double ) as double
  return deg * pi / 180
end function
sub rotate( byref k as double , byref l as double , deg as double )
  dim as double s , c , hk , hl
  s = sin( rad( deg ) )
  c = cos( rad( deg ) )
  hk = k * c - l * s
  hl = k * s + l * c
  k = hk
  l = hl
end sub
sub scale( byref x as double , byref y as double , f as double )
  x = x * f
  y = y * f
end sub
sub translate( byref x as double , byref y as double _
  , dx as double , dy as double )
  x = x + dx
  y = y + dy
end sub
function length( x as double , y as double ) as double
  length = sqr( x * x + y * y )
end function
dim as integer winx , winy , tel
dim as double x , y , ex , ey
dim as string in
dim as double angle , factor
input "angle [ 0 ... 360 ] = " ; in
angle = val( in )
if angle = 0 then angle = 360 * golden_ratio
input "factor [ 0 ... 1 ] = " ; in
factor = val( in )
if factor = 0 then factor = golden_ratio

randomize timer
screen 20 , 32
screeninfo winx , winy


  x = rnd * winy - winy / 2
  y = rnd * winy - winy / 2

  while tel < 10000
    tel = tel + 1
    ex = winx / 2 + x
    ey = winy / 2 + y
    pset ( ex , ey ) , rgb( 0 , 255 , 0 )
''this is the recepy from 1989 there may be other's
''feel free to experiment whit this and report good recepy's
    if rnd < .1 then
      scale x , y , 1 / 2
      translate x , y , winy / 4 , winy / 4
    else
      rotate x , y , angle
      scale x , y , factor
    end if
''end recepy from 1989
''i tryed this recepy myself 
''    if rnd < 1/3 then
''      rotate x , y , angle
''      scale x , y , factor
''    else
''      if rnd < 2/3 then
''        scale x , y , factor
''        translate x , y , 50 , 50
''      else
''        ''translate x , y , 50 , 50
''        rotate x , y , -angle * golden_ratio
''      end if
''    end if
''end recepy
  wend

sleep 
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: QB4.5 fractel [1989]

Post by badidea »

bluatigro wrote:i found this in a old magazine
De Kijk?
bluatigro
Posts: 660
Joined: Apr 25, 2012 10:35
Location: netherlands

Re: QB4.5 fractel [1989]

Post by bluatigro »

no a old computer club one [zcv]
Post Reply