stairs Art/Electric
PROGRAMS
general
color methods
col hypercube
fuzzy logic 1
fuzzy logic 2
fuzzy logic 3
macrame
mandelzoom
julia set
ripples
sines
newton's basin
hadamard matrix
 
PROGRAMS 2
L-systems
IF-Systems
 
e-mail
HADAMARD MATRIX SIMULATION
comparison - hadamard matrix simulation
mouseover for comparison - hadamard matrix simulation

PROGRAM HADAMARD   !© W.van Duyn 17th May 2004
SET MODE "color"
SET WINDOW 0,1199,0,903
SET BACKGROUND COLOR "white"
CLEAR
CALL init
END

SUB init
PRINT "input: Side try 512,level try 6 (max 8)"
INPUT size,n
CLEAR
SET COLOR "black"
BOX AREA 0,1199,0,903
LET x0=0
LET y0=0
LET x1=size
LET y1=size
LET border=3
LET d=(size/2^n-border)
CALL recur(0,0,size,size,n,d,1)
END SUB

SUB recur(x0,y0,x1,y1,n,d,col)
LET x2 = (x0+x1)/2
LET y2 = (y0+y1)/2
IF n=0 THEN
IF col=1 THEN
SET COLOR "red"
END IF
IF col=2 THEN
SET COLOR "red"
END IF
IF col=0 THEN
SET COLOR "white"
END IF
CALL moveON(x2,y2,d)
ELSE
CALL recur(x0,y0,x2,y2,n-1,d,col)
!put col = 2 in above recursive call to produce diagram shown
CALL recur(x2,y2,x1,y1,n-1,d,col)
CALL recur(x0,y2,x2,y1,n-1,d,col)
CALL recur(x2,y0,x1,y2,n-1,d,0)
END IF
END SUB

SUB moveON(x2,y2,d)
LET xx=x2+d
LET yy=y2+d
BOX AREA x2,xx,y2,yy
END SUB


Website, Text and Some Images Copyright © 2002 tzingaro.com, all rights reserved.