Mauldin's appolonian works! - Now also in Q-basic

From: Suncode (sol_developments_at_hotmail.com)
Date: 06/01/04


Date: Tue, 1 Jun 2004 23:36:38 -0000

Hi Roger!

I converted your code to Q-Basic. I also optimized it a bit coz it's not
wery effective. You may be good at fractals but your code could get better
:-) Calculating the same constants over and over again in the main-loop i
not wery wise, same thing goes for calculating the same data more than once.

I also gave the fractal a little optimus. When you got long tip like the
black one here then you can set up a number of copies of the particular
transformation that takes the point to the peak. this will make it easier
for the function to find its way there and copletion will go faster. I use
10 transformations here and all numbered 2-9 (80%) is used for the first
transformation.

RANDOMIZE TIMER
SCREEN 12
PRINT " Mauldin's Appolonian gasket I.F.S. "
PRINT " BY R.L.BAGULA 31 May 2004 ©"
PRINT " Q-Basic version by SunCode/Sol Dev."
t# = TIMER + 3
WHILE t# > TIMER: WEND
LINE (0, 0)-(639, 479), 15, BF
pi# = ATN(1#) * 8#
x# = .5#
y# = .75#
ims% = 750
sc0# = SQR(3#) - 1#
sc1# = SQR(3#) + 1#
' Try also this for surface-fill: (REMove the REMarks)
REM sc0# = pi# - 1#
REM sc1# = pi# + 1#
xrot# = COS(2# * pi# / 3#)
yrot# = SIN(2# * pi# / 3#)
WHILE INKEY$ = ""
  xr# = xrot# * x# - yrot# * y#
  yr# = xrot# * y# + yrot# * x#
  x2# = xr#
  y2# = -yr#
  index% = INT(RND * 10)
  IF index% > 1 THEN
    xa# = sc0# * x# + 1#
    ya# = sc0# * y#
    xb# = -x# + sc1#
    yb# = -y#
    COLOR 0
  ELSE
    IF index% THEN
      xa# = sc0# * xr# + 1#
      ya# = sc0# * yr#
      xb# = -xr# + sc1#
      yb# = -yr#
      COLOR 4
    ELSE
      xa# = sc0# * x2# + 1#
      ya# = sc0# * y2#
      xb# = -x2# + sc1#
      yb# = -y2#
      COLOR 1
    END IF
  END IF
  l# = xb# * xb# + yb# * yb#
  xc# = xb# / l#
  yc# = -yb# / l#
  x1# = xa# * xc# - ya# * yc#
  y1# = xa# * yc# + xc# * ya#
  x# = x1#
  y# = y1#
  IF n! > 10 THEN
    PSET (-100 + ims% * x#, 240 + ims% * y#)
  END IF
  n! = n! + 1
WEND
SCREEN 0
END



Relevant Pages