Roger L. Bagula
2004-06-12 20:27:36 UTC
IMPROVED VERSION OF THE 4 PART SPACE FILL OF A SPHERE
DUE TO WILLIAM VAN DUYN.
I'M POSTING THE PICTURE TO ALT.FRACTALS
TRUE BASIC PROGRAM:
SET MODE "color"
SET WINDOW 0,1920,0,1024
SET BACKGROUND COLOR "white"
LET x=.2
LET y=.3
LET a=0
LET b =0
LET s1=400
LET s2 =s1*1024/1920
RANDOMIZE
LET z=rnd
PRINT" Circle Cantor set I.F.S. space filling sphere 4 transforms"
Print" adjusted by William van Duyn's Cantor set"
PRINT" BY R.L.BAGULA 12 June 2004 ©"
LET r=0.1
FOR n= 1 TO 1000000
LET a =RND
LET b=RND
IF a<= 1/4 AND a>0 THEN
LET t1=t/2
LET p1=p/2
LET r=(4*a)^(1/3)
SET COLOR "black"
END IF
IF a<=1/2 AND a>1/4 THEN
LET t1=t/2-1/2
LET p1=p/2
LET r=(4*a-1)^(1/3)
SET COLOR "red"
END IF
IF a<= 3/4 AND a>1/2 THEN
LET t1=t/2
LET p1=p/2-1/2
LET r=(4*a-2)^(1/3)
SET COLOR "blue"
END IF
IF a<= 1 AND a>3/4 THEN
LET t1=t/2-1/2
LET p1=p/2-1/2
LET r=(4*a-3)^(1/3)
SET COLOR "green"
END IF
LET t=t1
LET p=p1
REM disk to Sphere projection
LET x=r*cos(t*2*Pi)*Sin(Pi*p)
LET y=r*sin(t*2*Pi)*Sin(Pi*p)
LET z=r*Cos(Pi*p)
REM projection of views
LET x2=Cos(Pi/2)*x-Sin(Pi/2)*z
LET z2=Cos(Pi/2)*z+Sin(Pi/2)*x
LET y3=Cos(-Pi/2)*y-Sin(-Pi/2)*z
LET z3=Cos(-Pi/2)*z+Sin(-Pi/2)*y
IF n>10 THEN PLOT 1920/2+s1*(x/(1+z/4))-450,1024/2+s2*(y/(1+z/4))-150
IF n>10 THEN PLOT
1920/2+s1*(x2/(1+z2/4))+450,1024/2+s2*(y/(1+z2/4))-150
IF n>10 THEN PLOT 1920/2+s1*(x/(1+z3/4)),1024/2+s2*(y3/(1+z3/4))+275
NEXT n
END
DUE TO WILLIAM VAN DUYN.
I'M POSTING THE PICTURE TO ALT.FRACTALS
TRUE BASIC PROGRAM:
SET MODE "color"
SET WINDOW 0,1920,0,1024
SET BACKGROUND COLOR "white"
LET x=.2
LET y=.3
LET a=0
LET b =0
LET s1=400
LET s2 =s1*1024/1920
RANDOMIZE
LET z=rnd
PRINT" Circle Cantor set I.F.S. space filling sphere 4 transforms"
Print" adjusted by William van Duyn's Cantor set"
PRINT" BY R.L.BAGULA 12 June 2004 ©"
LET r=0.1
FOR n= 1 TO 1000000
LET a =RND
LET b=RND
IF a<= 1/4 AND a>0 THEN
LET t1=t/2
LET p1=p/2
LET r=(4*a)^(1/3)
SET COLOR "black"
END IF
IF a<=1/2 AND a>1/4 THEN
LET t1=t/2-1/2
LET p1=p/2
LET r=(4*a-1)^(1/3)
SET COLOR "red"
END IF
IF a<= 3/4 AND a>1/2 THEN
LET t1=t/2
LET p1=p/2-1/2
LET r=(4*a-2)^(1/3)
SET COLOR "blue"
END IF
IF a<= 1 AND a>3/4 THEN
LET t1=t/2-1/2
LET p1=p/2-1/2
LET r=(4*a-3)^(1/3)
SET COLOR "green"
END IF
LET t=t1
LET p=p1
REM disk to Sphere projection
LET x=r*cos(t*2*Pi)*Sin(Pi*p)
LET y=r*sin(t*2*Pi)*Sin(Pi*p)
LET z=r*Cos(Pi*p)
REM projection of views
LET x2=Cos(Pi/2)*x-Sin(Pi/2)*z
LET z2=Cos(Pi/2)*z+Sin(Pi/2)*x
LET y3=Cos(-Pi/2)*y-Sin(-Pi/2)*z
LET z3=Cos(-Pi/2)*z+Sin(-Pi/2)*y
IF n>10 THEN PLOT 1920/2+s1*(x/(1+z/4))-450,1024/2+s2*(y/(1+z/4))-150
IF n>10 THEN PLOT
1920/2+s1*(x2/(1+z2/4))+450,1024/2+s2*(y/(1+z2/4))-150
IF n>10 THEN PLOT 1920/2+s1*(x/(1+z3/4)),1024/2+s2*(y3/(1+z3/4))+275
NEXT n
END