Re: Mauldin's appolonian works! - Now also in Q-basic
From: Roger L. Bagula (rlbtftn_at_netscape.net)
Date: 06/02/04
- Next message: Suncode: "Re: IFS inverse algoritm"
- Previous message: Roger L. Bagula: "Re: Mauldin's appolonian works! - Now also in Q-basic"
- In reply to: Suncode: "Mauldin's appolonian works! - Now also in Q-basic"
- Next in thread: Suncode: "I FOUND MY MISTAKE! - And so did I."
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 02 Jun 2004 06:21:13 GMT
Another one made by removing one transform to get a symmetrical
triangular set: (it's kind of pretty!)
True basic:
SET MODE "color"
SET WINDOW 0,1920,0,1024
SET BACKGROUND COLOR "white"
LET x=.5
LET y=.75
LET a=0
LET b =0
LET s1=700
LET s2 =s1*1024/1920
RANDOMIZE
PRINT" NONLINEAR TRIANGLE SET I.F.S. "
PRINT" BY R.L.BAGULA 31 May 200 ©"
FOR n= 1 TO 10000000
LET a =RND
LET xr=cos(2*Pi/3)*x-sin(2*Pi/3)*y
LET yr=cos(2*Pi/3)*y+sin(2*Pi/3)*x
LET x2=xr
LET y2 =-yr
IF a<= 1/2 AND a>=0 THEN
LET xa=(sqr(3)-1)*x2+1
LET ya=(sqr(3)-1)*y2
LET xb=-x2+(sqr(3)+1)
LET yb=-y2
LET xc=xb/(xb*xb+yb*yb)
LET yc=-yb/(xb*xb+yb*yb)
LET x1=xa*xc-ya*yc
LET y1=xa*yc+xc*ya
SET COLOR"BLACK"
END IF
IF a<= 1 AND a>1/2 THEN
LET xa=(sqr(3)-1)*xr+1
LET ya=(sqr(3)-1)*yr
LET xb=-xr+(sqr(3)+1)
LET yb=-yr
LET xc=xb/(xb*xb+yb*yb)
LET yc=-yb/(xb*xb+yb*yb)
LET x1=xa*xc-ya*yc
LET y1=xa*yc+xc*ya
SET COLOR "RED"
END IF
LET x=x1*Sqr(3.66)
LET y=y1*Sqr(3.66)
IF n>10 THEN PLOT 1920/2+s1*y,1024/2+2*s2*x-250
NEXT n
END
Suncode wrote:
> 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
>
>
>
- Next message: Suncode: "Re: IFS inverse algoritm"
- Previous message: Roger L. Bagula: "Re: Mauldin's appolonian works! - Now also in Q-basic"
- In reply to: Suncode: "Mauldin's appolonian works! - Now also in Q-basic"
- Next in thread: Suncode: "I FOUND MY MISTAKE! - And so did I."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|