Tiling{ ;The method of determining the distance between a ;pixel and a segment has been taken from ;Kerry's LKM - Line coloring algoritm global: int k=0 ; number of lines complex d[75,2] $DEFINE debug ;designing the initial figure If @tip==0 d[1,1]=(0,-1)/8, d[1,0]=(2,1)/8 d[2,1]=(2,1)/8, d[2,0]=(2,2)/8 d[3,1]=(2,2)/8, d[3,0]=(3,2)/8 d[4,1]=(3,2)/8, d[4,0]=(5,4)/8 d[5,1]=(3,4)/8, d[5,0]=(5,2)/8 d[6,1]=(0,1)/8, d[6,0]=(2,-1)/8 k=6 endif If @tip==1 d[1,1]=(0,0)/12, d[1,0]=(2,3)/12 d[2,1]=(4,3)/12, d[2,0]=(2,3)/12 d[3,1]=(2,3)/12, d[3,0]=(0,6)/12 d[4,1]=(0,6)/12, d[4,0]=(3,8)/12 d[5,1]=(3,8)/12, d[5,0]=(3,10)/12 d[6,1]=(3,10)/12, d[6,0]=(0,12)/12 d[7,1]=(6,0)/12, d[7,0]=(4,3)/12 d[8,1]=(6,0)/12, d[8,0]=(9,2)/12 d[9,1]=(9,2)/12, d[9,0]=(9,4)/12 d[10,1]=(9,2)/12, d[10,0]=(12,0)/12 d[11,1]=(4,3)/12, d[11,0]=(8,9)/12; d[12,1]=(9,4)/12, d[12,0]=(3,8)/12; d[13,1]=(9,4)/12, d[13,0]=(12,6)/12 d[14,1]=(10,9)/12, d[14,0]=(12,6)/12 d[15,1]=(10,9)/12, d[15,0]=(8,9)/12 d[16,1]=(8,9)/12, d[16,0]=(6,12)/12 d[17,1]=(3,10)/12, d[17,0]=(6,12)/12 d[18,1]=(10,9)/12, d[18,0]=(12,12)/12 k=18 endif If @tip==2 d[1,1]=(0,4)/8, d[1,0]=(1,3)/8 d[2,1]=(1,3)/8, d[2,0]=(1,2)/8 d[3,1]=(1,2)/8, d[3,0]=(3,2)/8 d[4,1]=(3,2)/8, d[4,0]=(3,1)/8 d[5,1]=(3,1)/8, d[5,0]=(5,-1)/8 d[6,1]=(-1,-1)/8, d[6,0]=(1,1)/8 d[7,1]=(1,1)/8, d[7,0]=(2,1)/8 d[8,1]=(2,1)/8, d[8,0]=(2,3)/8 d[9,1]=(2,3)/8, d[9,0]=(3,3)/8 d[10,1]=(3,3)/8, d[10,0]=(5,5)/8 d[11,1]=(3,5)/8, d[11,0]=(5,3)/8 d[12,1]=(3,-1)/8, d[12,0]=(5,1)/8 d[13,1]=(-1,1)/8, d[13,0]=(1,-1)/8 d[14,1]=(-1,3)/8, d[14,0]=(1,5)/8 k=14 endif If @tip==3 d[1,1]=(4,10)/18, d[1,0]=(2,8)/18 d[2,1]=(2,8)/18, d[2,0]=(2,1)/18 d[3,1]=(2,1)/18, d[3,0]=(3,0)/18 d[4,1]=(0,3)/18, d[4,0]=(1,2)/18 d[5,1]=(1,2)/18, d[5,0]=(8,2)/18 d[6,1]=(8,2)/18, d[6,0]=(10,4)/18 d[7,1]=(10,2)/18, d[7,0]=(2,10)/18 d[8,1]=(-1,7)/18, d[8,0]=(7,-1)/18 d[9,1]=(5,-1)/18, d[9,0]=(7,1)/18 d[10,1]=(7,1)/18, d[10,0]=(7,8)/18 d[11,1]=(7,8)/18, d[11,0]=(6,9)/18 d[12,1]=(9,6)/18, d[12,0]=(8,7)/18 d[13,1]=(8,7)/18, d[13,0]=(1,7)/18 d[14,1]=(1,7)/18, d[14,0]=(-1,5)/18 k=14 endif If @tip==4 d[1,1]=(-0.5,1), d[1,0]=(0.5,3) d[2,1]=(-0.5,3), d[2,0]=(0.5,1) d[3,1]=(0.5,1), d[3,0]=(2.5,1) d[4,1]=(1,0), d[4,0]=(2,2) d[5,1]=(2,2), d[5,0]=(4,2) d[6,1]=(4,2), d[6,0]=(5,0) d[7,1]=(5,2), d[7,0]=(4,0) d[8,1]=(2.5,1), d[8,0]=(3.5,3) k=8 int counter=0 repeat counter=counter+1 d[counter,1]=real(d[counter,1])/9+flip(imag(d[counter,1])/6) d[counter,0]=real(d[counter,0])/9+flip(imag(d[counter,0])/6) until counter == k endif If @tip==5 d[1,1]=(1,-1), d[1,0]=(1,2) d[2,1]=(1,2), d[2,0]=(3,4) d[3,1]=(3,4), d[3,0]=(3,7) d[4,1]=(-1,4), d[4,0]=(1,4) d[5,1]=(1,4), d[5,0]=(3,2) d[6,1]=(3,2), d[6,0]=(5,2) k=6 int counter=0 repeat counter=counter+1 d[counter,1]=real(d[counter,1])/8+flip(imag(d[counter,1])/12) d[counter,0]=real(d[counter,0])/8+flip(imag(d[counter,0])/12) until counter == k endif If @tip==6 d[1,1]=(-1,13)/12, d[1,0]=(1,11)/12 d[2,1]=(1,11)/12, d[2,0]=(4,11)/12 d[3,1]=(4,11)/12, d[3,0]=(4,10)/12 d[4,1]=(4,10)/12, d[4,0]=(6,8)/12 d[5,1]=(6,8)/12, d[5,0]=(8,10)/12 d[6,1]=(8,10)/12, d[6,0]=(8,11)/12 d[7,1]=(8,11)/12, d[7,0]=(11,11)/12 d[8,1]=(11,11)/12, d[8,0]=(13,13)/12 d[9,1]=(-1,11)/12, d[9,0]=(2,8)/12 d[10,1]=(2,8)/12, d[10,0]=(2,7)/12 d[11,1]=(2,7)/12, d[11,0]=(5,7)/12 d[12,1]=(5,7)/12, d[12,0]=(7,5)/12 d[13,1]=(7,5)/12, d[13,0]=(10,5)/12 d[14,1]=(10,5)/12, d[14,0]=(10,4)/12 d[15,1]=(10,4)/12, d[15,0]=(13,1)/12 d[16,1]=(5,13)/12, d[16,0]=(2,10)/12 d[17,1]=(2,10)/12, d[17,0]=(1,10)/12 d[18,1]=(1,10)/12, d[18,0]=(1,7)/12 d[19,1]=(1,7)/12, d[19,0]=(-1,5)/12 d[20,1]=(-1,7)/12, d[20,0]=(1,5)/12 d[21,1]=(1,5)/12, d[21,0]=(1,2)/12 d[22,1]=(1,2)/12, d[22,0]=(2,2)/12 d[23,1]=(2,2)/12, d[23,0]=(5,-1)/12 d[24,1]=(-1,1)/12, d[24,0]=(2,4)/12 d[25,1]=(2,4)/12, d[25,0]=(2,5)/12 d[26,1]=(2,5)/12, d[26,0]=(5,5)/12 d[27,1]=(5,5)/12, d[27,0]=(7,7)/12 d[28,1]=(7,7)/12, d[28,0]=(10,7)/12 d[29,1]=(10,7)/12, d[29,0]=(10,8)/12 d[30,1]=(10,8)/12, d[30,0]=(13,11)/12 d[31,1]=(-1,-1)/12, d[31,0]=(1,1)/12 d[32,1]=(1,1)/12, d[32,0]=(4,1)/12 d[33,1]=(4,1)/12, d[33,0]=(4,2)/12 d[34,1]=(4,2)/12, d[34,0]=(6,4)/12 d[35,1]=(6,4)/12, d[35,0]=(8,2)/12 d[36,1]=(8,2)/12, d[36,0]=(8,1)/12 d[37,1]=(8,1)/12, d[37,0]=(11,1)/12 d[38,1]=(11,1)/12, d[38,0]=(13,-1)/12 d[39,1]=(7,13)/12, d[39,0]=(5,11)/12 d[40,1]=(5,11)/12, d[40,0]=(5,8)/12 d[41,1]=(5,8)/12, d[41,0]=(4,8)/12 d[42,1]=(4,8)/12, d[42,0]=(2,6)/12 d[43,1]=(2,6)/12, d[43,0]=(4,4)/12 d[44,1]=(4,4)/12, d[44,0]=(5,4)/12 d[45,1]=(5,4)/12, d[45,0]=(5,1)/12 d[46,1]=(5,1)/12, d[46,0]=(7,-1)/12 d[47,1]=(5,-1)/12, d[47,0]=(7,1)/12 d[48,1]=(7,1)/12, d[48,0]=(7,4)/12 d[49,1]=(7,4)/12, d[49,0]=(8,4)/12 d[50,1]=(8,4)/12, d[50,0]=(10,6)/12 d[51,1]=(10,6)/12, d[51,0]=(8,8)/12 d[52,1]=(8,8)/12, d[52,0]=(7,8)/12 d[53,1]=(7,8)/12, d[53,0]=(7,11)/12 d[54,1]=(7,11)/12, d[54,0]=(5,13)/12 d[55,1]=(7,13)/12, d[55,0]=(10,10)/12 d[56,1]=(10,10)/12, d[56,0]=(11,10)/12 d[57,1]=(11,10)/12, d[57,0]=(11,7)/12 d[58,1]=(11,7)/12, d[58,0]=(13,5)/12 d[59,1]=(13,7)/12, d[59,0]=(11,5)/12 d[60,1]=(11,5)/12, d[60,0]=(11,2)/12 d[61,1]=(11,2)/12, d[61,0]=(10,2)/12 d[62,1]=(10,2)/12, d[62,0]=(7,-1)/12 k=62 endif If @tip==7 d[1,1]=(-1,-3)/18, d[1,0]=(3,1)/18 d[2,1]=(3,1)/18, d[2,0]=(7,1)/18 d[3,1]=(7,1)/18, d[3,0]=(11,5)/18 d[4,1]=(11,1)/18, d[4,0]=(7,5)/18 d[5,1]=(7,5)/18, d[5,0]=(5,5)/18 d[6,1]=(5,5)/18, d[6,0]=(5,7)/18 d[7,1]=(5,7)/18, d[7,0]=(1,11)/18 d[8,1]=(5,11)/18, d[8,0]=(1,7)/18 d[9,1]=(1,7)/18, d[9,0]=(1,3)/18 d[10,1]=(1,3)/18, d[10,0]=(-3,-1)/18 d[11,1]=(-3,5)/18, d[11,0]=(5,-3)/18 k=11 endif If @tip==8 d[1,1]=(1,-1)/10, d[1,0]=(3,1)/10 d[2,1]=(3,1)/10, d[2,0]=(4,1)/10 d[3,1]=(4,1)/10, d[3,0]=(6,3)/10 d[4,1]=(6,1)/10, d[4,0]=(4,3)/10 d[5,1]=(4,3)/10, d[5,0]=(4,4)/10 d[6,1]=(4,4)/10, d[6,0]=(2,6)/10 d[7,1]=(4,6)/10, d[7,0]=(2,4)/10 d[8,1]=(2,4)/10, d[8,0]=(1,4)/10 d[9,1]=(1,4)/10, d[9,0]=(-1,2)/10 d[10,1]=(-1,4)/10, d[10,0]=(1,2)/10 d[11,1]=(1,2)/10, d[11,0]=(1,1)/10 d[12,1]=(1,1)/10, d[12,0]=(3,-1)/10 k=12 endif If @tip==9 d[1,1]=(-1,3)/20, d[1,0]=(1,5)/20 d[2,1]=(1,5)/20, d[2,0]=(1,9)/20 d[3,1]=(1,9)/20, d[3,0]=(5,9)/20 d[4,1]=(5,9)/20, d[4,0]=(7,11)/20 d[5,1]=(5,11)/20, d[5,0]=(9,7)/20 d[6,1]=(9,7)/20, d[6,0]=(9,5)/20 d[7,1]=(9,5)/20, d[7,0]=(11,3)/20 d[8,1]=(11,5)/20, d[8,0]=(9,3)/20 d[9,1]=(9,3)/20, d[9,0]=(9,1)/20 d[10,1]=(9,1)/20, d[10,0]=(7,1)/20 d[11,1]=(7,1)/20, d[11,0]=(5,-1)/20 d[12,1]=(7,-1)/20, d[12,0]=(5,1)/20 d[13,1]=(5,1)/20, d[13,0]=(3,1)/20 d[14,1]=(3,1)/20, d[14,0]=(-1,5)/20 d[15,1]=(1,-1)/20, d[15,0]=(1,1)/20 d[16,1]=(1,1)/20, d[16,0]=(9,9)/20 d[17,1]=(9,9)/20, d[17,0]=(11,9)/20 d[18,1]=(3,7)/20, d[18,0]=(5,7)/20 d[19,1]=(5,7)/20, d[19,0]=(7,5)/20 d[20,1]=(7,5)/20, d[20,0]=(7,3)/20 d[21,1]=(7,3)/20, d[21,0]=(5,3)/20 d[22,1]=(5,3)/20, d[22,0]=(3,5)/20 d[23,1]=(3,5)/20, d[23,0]=(3,7)/20 k=23 endif If @tip==10 d[1,1]=(-1,6)/24, d[1,0]=(2,9)/24 d[2,1]=(2,9)/24, d[2,0]=(2,10)/24 d[3,1]=(2,10)/24, d[3,0]=(3,10)/24 d[4,1]=(3,10)/24, d[4,0]=(6,13)/24 d[5,1]=(4,13)/24, d[5,0]=(6,11)/24 d[6,1]=(6,11)/24, d[6,0]=(11,11)/24 d[7,1]=(11,11)/24, d[7,0]=(13,9)/24 d[8,1]=(13,11)/24, d[8,0]=(11,9)/24 d[9,1]=(11,9)/24, d[9,0]=(10,9)/24 d[10,1]=(10,9)/24, d[10,0]=(8,7)/24 d[11,1]=(8,7)/24, d[11,0]=(13,2)/24 d[12,1]=(13,4)/24, d[12,0]=(11,2)/24 d[13,1]=(11,2)/24, d[13,0]=(5,2)/24 d[14,1]=(5,2)/24, d[14,0]=(3,4)/24 d[15,1]=(3,4)/24, d[15,0]=(5,6)/24 d[16,1]=(5,6)/24, d[16,0]=(5,8)/24 d[17,1]=(5,8)/24, d[17,0]=(10,13)/24 d[18,1]=(-1,2)/24, d[18,0]=(4,7)/24 d[19,1]=(4,7)/24, d[19,0]=(6,7)/24 d[20,1]=(6,7)/24, d[20,0]=(8,9)/24 d[21,1]=(8,9)/24, d[21,0]=(10,7)/24 d[22,1]=(10,7)/24, d[22,0]=(10,1)/24 d[23,1]=(10,1)/24, d[23,0]=(8,-1)/24 d[24,1]=(10,-1)/24, d[24,0]=(5,4)/24 d[25,1]=(5,4)/24, d[25,0]=(3,2)/24 d[26,1]=(3,2)/24, d[26,0]=(3,1)/24 d[27,1]=(3,1)/24, d[27,0]=(1,-1)/24 d[28,1]=(3,-1)/24, d[28,0]=(1,1)/24 d[29,1]=(1,1)/24, d[29,0]=(1,6)/24 d[30,1]=(1,6)/24, d[30,0]=(-1,8)/24 k=30 endif If @tip==11 d[1,1]=(0,15)/16, d[1,0]=(2,15)/16 d[2,1]=(2,15)/16, d[2,0]=(4,17)/16 d[3,1]=(2,17)/16, d[3,0]=(4,15)/16 d[4,1]=(4,15)/16, d[4,0]=(5,15)/16 d[5,1]=(5,15)/16, d[5,0]=(5,11)/16 d[6,1]=(5,11)/16, d[6,0]=(1,11)/16 d[7,1]=(1,11)/16, d[7,0]=(1,7)/16 d[8,1]=(1,7)/16, d[8,0]=(2,7)/16 d[9,1]=(2,7)/16, d[9,0]=(4,5)/16 d[10,1]=(4,5)/16, d[10,0]=(5,5)/16 d[11,1]=(5,5)/16, d[11,0]=(5,4)/16 d[12,1]=(5,4)/16, d[12,0]=(7,2)/16 d[13,1]=(7,2)/16, d[13,0]=(7,0)/16 d[14,1]=(0,13)/16, d[14,0]=(3,13)/16 d[15,1]=(3,13)/16, d[15,0]=(3,9)/16 d[16,1]=(3,9)/16, d[16,0]=(7,9)/16 d[17,1]=(7,9)/16, d[17,0]=(7,10)/16 d[18,1]=(7,10)/16, d[18,0]=(9,12)/16 d[19,1]=(9,12)/16, d[19,0]=(9,13)/16 d[20,1]=(9,13)/16, d[20,0]=(10,13)/16 d[21,1]=(10,13)/16, d[21,0]=(12,15)/16 d[22,1]=(12,15)/16, d[22,0]=(16,15)/16 d[23,1]=(16,13)/16, d[23,0]=(15,13)/16 d[24,1]=(15,13)/16, d[24,0]=(15,12)/16 d[25,1]=(15,12)/16, d[25,0]=(13,10)/16 d[26,1]=(13,10)/16, d[26,0]=(13,9)/16 d[27,1]=(13,9)/16, d[27,0]=(12,9)/16 d[28,1]=(12,9)/16, d[28,0]=(10,7)/16 d[29,1]=(10,7)/16, d[29,0]=(4,7)/16 d[30,1]=(4,7)/16, d[30,0]=(2,5)/16 d[31,1]=(2,5)/16, d[31,0]=(1,5)/16 d[32,1]=(1,5)/16, d[32,0]=(1,4)/16 d[33,1]=(1,4)/16, d[33,0]=(-1,2)/16 d[34,1]=(-1,4)/16, d[34,0]=(1,2)/16 d[35,1]=(1,2)/16, d[35,0]=(1,1)/16 d[36,1]=(1,1)/16, d[36,0]=(2,1)/16 d[37,1]=(2,1)/16, d[37,0]=(4,-1)/16 d[38,1]=(2,-1)/16, d[38,0]=(4,1)/16 d[39,1]=(4,1)/16, d[39,0]=(5,1)/16 d[40,1]=(5,1)/16, d[40,0]=(5,2)/16 d[41,1]=(5,2)/16, d[41,0]=(7,4)/16 d[42,1]=(7,4)/16, d[42,0]=(7,5)/16 d[43,1]=(7,5)/16, d[43,0]=(11,5)/16 d[44,1]=(11,5)/16, d[44,0]=(11,1)/16 d[45,1]=(11,1)/16, d[45,0]=(15,1)/16 d[46,1]=(15,1)/16, d[46,0]=(15,2)/16 d[47,1]=(15,2)/16, d[47,0]=(17,4)/16 d[48,1]=(17,2)/16, d[48,0]=(15,4)/16 d[49,1]=(15,4)/16, d[49,0]=(15,10)/16 d[50,1]=(15,10)/16, d[50,0]=(13,12)/16 d[51,1]=(13,12)/16, d[51,0]=(13,13)/16 d[52,1]=(13,13)/16, d[52,0]=(12,13)/16 d[53,1]=(12,13)/16, d[53,0]=(10,15)/16 d[54,1]=(10,15)/16, d[54,0]=(9,15)/16 d[55,1]=(9,15)/16, d[55,0]=(9,16)/16 d[56,1]=(7,16)/16, d[56,0]=(7,12)/16 d[57,1]=(7,12)/16, d[57,0]=(9,10)/16 d[58,1]=(9,10)/16, d[58,0]=(9,9)/16 d[59,1]=(9,9)/16, d[59,0]=(10,9)/16 d[60,1]=(10,9)/16, d[60,0]=(12,7)/16 d[61,1]=(12,7)/16, d[61,0]=(13,7)/16 d[62,1]=(13,7)/16, d[62,0]=(13,3)/16 d[63,1]=(13,3)/16, d[63,0]=(9,3)/16 d[64,1]=(9,3)/16, d[64,0]=(9,0)/16 k=64 endif If @tip==12 d[1,1]=(3,-0.5), d[1,0]=(1,0.5) d[2,1]=(1,0.5), d[2,0]=(1,2.5) d[3,1]=(1,2.5), d[3,0]=(-1,3.5) d[4,1]=(-1,2.5), d[4,0]=(1,3.5) d[5,1]=(1,3.5), d[5,0]=(1,5.5) d[6,1]=(1,5.5), d[6,0]=(3,6.5) d[7,1]=(1,6.5), d[7,0]=(3,5.5) d[8,1]=(3,5.5), d[8,0]=(3,3.5) d[9,1]=(3,3.5), d[9,0]=(5,2.5) d[10,1]=(5,3.5), d[10,0]=(3,2.5) d[11,1]=(3,2.5), d[11,0]=(3,0.5) d[12,1]=(3,0.5), d[12,0]=(1,-0.5) d[13,1]=(0,1), d[13,0]=(2,2) d[14,1]=(2,2), d[14,0]=(4,1) d[15,1]=(0,5), d[15,0]=(2,4) d[16,1]=(2,4), d[16,0]=(4,5) k=16 int counter=0 repeat counter=counter+1 d[counter,1]=real(d[counter,1])/4+flip(imag(d[counter,1])/6) d[counter,0]=real(d[counter,0])/4+flip(imag(d[counter,0])/6) until counter == k endif If @tip==13 d[1,1]=(16,-20), d[1,0]=(58,52) d[2,1]=(58,52), d[2,0]=(29,107) d[3,1]=(29,107), d[3,0]=(55,137) d[4,1]=(55,137), d[4,0]=(35,216) d[5,1]=(35,216), d[5,0]=(81,284) d[6,1]=(81,284), d[6,0]=(39,376) d[7,1]=(139,-15), d[7,0]=(110,51) d[8,1]=(110,51), d[8,0]=(154,118) d[9,1]=(154,118), d[9,0]=(136,197) d[10,1]=(136,197), d[10,0]=(162,226) d[11,1]=(162,226), d[11,0]=(132,282) d[12,1]=(132,282), d[12,0]=(186,376) d[13,1]=(79,-16), d[13,0]=(107,29) d[14,1]=(107,29), d[14,0]=(146,21) d[15,1]=(146,21), d[15,0]=(222,83) d[16,1]=(216,43), d[16,0]=(179,76) d[17,1]=(179,76), d[17,0]=(97,71) d[18,1]=(97,71), d[18,0]=(65,115) d[19,1]=(65,115), d[19,0]=(10,121) d[20,1]=(10,121), d[20,0]=(-24,193) d[21,1]=(-22,103), d[21,0]=(23,195) d[22,1]=(23,195), d[22,0]=(101,218) d[23,1]=(101,218), d[23,0]=(113,255) d[24,1]=(113,255), d[24,0]=(177,257) d[25,1]=(177,257), d[25,0]=(223,329) d[26,1]=(222,255), d[26,0]=(176,307) d[27,1]=(176,307), d[27,0]=(116,309) d[28,1]=(116,309), d[28,0]=(85,374) d[29,1]=(128,375), d[29,0]=(85,306) d[30,1]=(85,306), d[30,0]=(45,314) d[31,1]=(45,314), d[31,0]=(-16,256) d[32,1]=(-14,342), d[32,0]=(22,322) d[33,1]=(22,322), d[33,0]=(31,242) d[34,1]=(31,242), d[34,0]=(97,194) d[35,1]=(97,194), d[35,0]=(94,142) d[36,1]=(94,142), d[36,0]=(159,93) d[37,1]=(159,93), d[37,0]=(168,13) d[38,1]=(168,13), d[38,0]=(222,-14) d[39,1]=(102,-21), d[39,0]=(73,26) d[40,1]=(73,26), d[40,0]=(14,27) d[41,1]=(14,27), d[41,0]=(-19,84) d[42,1]=(-20,23), d[42,0]=(15,78) d[43,1]=(15,78), d[43,0]=(78,81) d[44,1]=(78,81), d[44,0]=(90,118) d[45,1]=(90,118), d[45,0]=(168,140) d[46,1]=(168,140), d[46,0]=(217,220) d[47,1]=(225,130), d[47,0]=(179,213) d[48,1]=(179,213), d[48,0]=(125,219) d[49,1]=(125,219), d[49,0]=(93,262) d[50,1]=(93,262), d[50,0]=(11,257) d[51,1]=(11,257), d[51,0]=(-28,290) d[52,1]=(-32,200), d[52,0]=(74,153) d[53,1]=(74,153), d[53,0]=(118,182) d[54,1]=(118,182), d[54,0]=(223,133) k=54 int counter=0 repeat counter=counter+1 d[counter,1]=real(d[counter,1])/195/2+flip(imag(d[counter,1])/335/2) d[counter,0]=real(d[counter,0])/195/2+flip(imag(d[counter,0])/335/2) until counter == k endif If @tip==14 d[1,1]=(86,-31), d[1,0]=(25,5) d[2,1]=(25,5), d[2,0]=(77,98) d[3,1]=(21,129), d[3,0]=(48,83) d[4,1]=(48,83), d[4,0]=(156,82) d[5,1]=(156,82), d[5,0]=(157,9) d[6,1]=(157,9), d[6,0]=(189,-9) d[7,1]=(190,10), d[7,0]=(157,-10) d[8,1]=(-16,89), d[8,0]=(17,108) d[9,1]=(-16,108), d[9,0]=(17,89) d[10,1]=(17,89), d[10,0]=(17,16) d[11,1]=(17,16), d[11,0]=(125,15) d[12,1]=(125,15), d[12,0]=(153,-32) d[13,1]=(126,-17), d[13,0]=(180,76) d[14,1]=(202,17), d[14,0]=(167,76) d[15,1]=(167,76), d[15,0]=(104,40) d[16,1]=(104,40), d[16,0]=(70,59) d[17,1]=(70,59), d[17,0]=(6,23) d[18,1]=(6,23), d[18,0]=(-13,54) d[19,1]=(87,-18), d[19,0]=(150,92) d[20,1]=(150,92), d[20,0]=(92,126) d[21,1]=(150,104), d[21,0]=(88,69) d[22,1]=(88,69), d[22,0]=(86,30) d[23,1]=(86,30), d[23,0]=(24,-7) d[24,1]=(-6,23), d[24,0]=(49,115) k=24 int counter=0 repeat counter=counter+1 d[counter,1]=real(d[counter,1])/173/2+flip(imag(d[counter,1])/98/2) d[counter,0]=real(d[counter,0])/173/2+flip(imag(d[counter,0])/98/2) until counter == k endif If @tip==15 d[1,1]=(2,2)/126, d[1,0]=(-21,60)/126 d[2,1]=(2,2)/126, d[2,0]=(44,-14)/126 d[3,1]=(0,-3)/126, d[3,0]=(76,28)/126 d[4,1]=(54,-4)/126, d[4,0]=(71,3)/126 d[5,1]=(-13,21)/126, d[5,0]=(84,62)/126 d[6,1]=(-3,47)/126, d[6,0]=(50,68)/126 d[7,1]=(30,-10)/126, d[7,0]=(-1,65)/126 d[8,1]=(52,-10)/126, d[8,0]=(16,76)/126 d[9,1]=(75,5)/126, d[9,0]=(49,71)/126 d[10,1]=(-4,54)/126, d[10,0]=(3,71)/126 d[11,1]=(-3,0)/126, d[11,0]=(27,77)/126 d[12,1]=(23,-8)/126, d[12,0]=(54,67)/126 d[13,1]=(47,-3)/126, d[13,0]=(68,48)/126 d[14,1]=(-4,28)/126, d[14,0]=(75,-5)/126 d[15,1]=(-9,52)/126, d[15,0]=(76,17)/126 d[16,1]=(25,68)/126, d[16,0]=(85,45)/126 k=16 endif If @tip==16 d[1,1]=(0,66), d[1,0]=(45,35) d[2,1]=(-5,17), d[2,0]=(12,69) d[3,1]=(12,69), d[3,0]=(67,70) d[4,1]=(67,70), d[4,0]=(76,96) d[5,1]=(70,97), d[5,0]=(79,70) d[6,1]=(79,70), d[6,0]=(113,69) d[7,1]=(113,69), d[7,0]=(130,17) d[8,1]=(124,70), d[8,0]=(106,17) d[9,1]=(106,17), d[9,0]=(50,16) d[10,1]=(50,16), d[10,0]=(39,-16) d[11,1]=(50,-16), d[11,0]=(39,16) d[12,1]=(39,16), d[12,0]=(5,17) d[13,1]=(5,17), d[13,0]=(-9,58) d[14,1]=(45,34), d[14,0]=(73,54) d[15,1]=(73,54), d[15,0]=(119,22) d[16,1]=(-11,9), d[16,0]=(29,-21) d[17,1]=(98,-6), d[17,0]=(54,27) d[18,1]=(54,27), d[18,0]=(64,59) d[19,1]=(64,59), d[19,0]=(20,92) d[20,1]=(-11,-9), d[20,0]=(36,27) d[21,1]=(36,27), d[21,0]=(19,80) d[22,1]=(61,-21), d[22,0]=(98,6) d[23,1]=(98,6), d[23,0]=(82,59) d[24,1]=(82,59), d[24,0]=(118,86) d[25,1]=(105,97), d[25,0]=(154,59) d[26,1]=(19,80), d[26,0]=(41,97) k=26 int counter=0 repeat counter=counter+1 d[counter,1]=real(d[counter,1])/119/2+flip(imag(d[counter,1])/87/2) d[counter,0]=real(d[counter,0])/119/2+flip(imag(d[counter,0])/87/2) until counter == k endif If @tip==17 d[1,1]=(-21,66), d[1,0]=(6,20) d[2,1]=(6,20), d[2,0]=(52,46) d[3,1]=(52,46), d[3,0]=(73,27) d[4,1]=(73,27), d[4,0]=(92,45) d[5,1]=(85,49), d[5,0]=(79,23) d[6,1]=(79,23), d[6,0]=(107,15) d[7,1]=(105,23), d[7,0]=(77,15) d[8,1]=(77,15), d[8,0]=(68,-15) d[9,1]=(68,14), d[9,0]=(15,15) d[10,1]=(15,15), d[10,0]=(14,68) d[11,1]=(14,68), d[11,0]=(-13,76) d[12,1]=(-14,68), d[12,0]=(13,76) d[13,1]=(13,76), d[13,0]=(7,102) d[14,1]=(7,102), d[14,0]=(32,109) d[15,1]=(32,109), d[15,0]=(26,136) d[16,1]=(26,136), d[16,0]=(72,164) d[17,1]=(45,170), d[17,0]=(72,153) d[18,1]=(72,153), d[18,0]=(46,106) d[19,1]=(46,106), d[19,0]=(66,85) d[20,1]=(66,85), d[20,0]=(60,56) d[21,1]=(60,56), d[21,0]=(85,49) d[22,1]=(21,-5), d[22,0]=(66,22) d[23,1]=(66,22), d[23,0]=(60,49) d[24,1]=(60,49), d[24,0]=(85,56) d[25,1]=(85,56), d[25,0]=(79,82) d[26,1]=(79,82), d[26,0]=(108,91) d[27,1]=(105,82), d[27,0]=(78,90) d[28,1]=(78,90), d[28,0]=(78,144) d[29,1]=(78,144), d[29,0]=(24,144) d[30,1]=(24,144), d[30,0]=(17,169) d[31,1]=(23,170), d[31,0]=(15,143) d[32,1]=(15,143), d[32,0]=(-12,136) d[33,1]=(-15,144), d[33,0]=(13,135) d[34,1]=(13,135), d[34,0]=(6,109) d[35,1]=(6,109), d[35,0]=(32,102) d[36,1]=(32,102), d[36,0]=(26,73) d[37,1]=(26,73), d[37,0]=(46,52) d[38,1]=(46,52), d[38,0]=(21,5) d[39,1]=(-5,20), d[39,0]=(22,66) d[40,1]=(22,66), d[40,0]=(52,59) d[41,1]=(52,59), d[41,0]=(72,79) d[42,1]=(72,79), d[42,0]=(92,60) d[43,1]=(0,98), d[43,0]=(19,80) d[44,1]=(19,80), d[44,0]=(41,100) d[45,1]=(41,100), d[45,0]=(70,92) d[46,1]=(70,92), d[46,0]=(97,138) d[47,1]=(0,114), d[47,0]=(19,132) d[48,1]=(19,132), d[48,0]=(40,112) d[49,1]=(40,112), d[49,0]=(87,138) d[50,1]=(87,138), d[50,0]=(113,94) d[51,1]=(77,-15), d[51,0]=(68,14) d[52,1]=(66,-22), d[52,0]=(20,5) k=52 int counter=0 repeat counter=counter+1 d[counter,1]=real(d[counter,1])/92/2+flip(imag(d[counter,1])/159/2) d[counter,0]=real(d[counter,0])/92/2+flip(imag(d[counter,0])/159/2) until counter == k endif Init: ;tilling int mod=(@mod*100)+1 complex z=real(#z)%mod+flip(imag(#z)%mod) If @tip==5 z=real(#z*1.5)%mod+flip(imag(#z)%mod) endif If @tip==12 z=real(#z*1.5)%mod+flip(imag(#z)%mod) endif If @tip==13 z=real(#z*335/195)%mod+flip(imag(#z)%mod) endif If @tip==14 z=real(#z/(173/98))%mod+flip(imag(#z)%mod) endif If @tip==4 z=real(#z)/(9/(6*sqrt(3)/2))%mod+flip(imag(#z)%mod) endif If @tip==16 z=real((#z)/(119/87))%mod+flip(imag(#z)%mod) endif If @tip==17 z=real((#z)/(92/159))%mod+flip(imag(#z)%mod) endif bool simetry = false if (@tip==17)||(@tip==16)||(@tip==13)||(@tip==14)||(@tip==10)||(@tip==9)||(@tip==2)||(@tip==0)||(@tip==3)||(@tip==4)||(@tip==5)||(@tip==7)||(@tip==8)||(@tip==15) if real(z)>0.5 z=(0,1)*imag(z)+1-real(z) simetry=!simetry endif if imag(z)>0.5 z=real(z)+(0,1)*(1-imag(z)) simetry=!simetry endif endif ; the folowing section is taken from Kerry's "Line" - lkm ; I've changed variable "r" to "rr" float rr=0.0 ;distance to segment float x=0.0 float y=0.0 t=(0,0) ; end of Kerry's declariations final: float d1=100 ;the distance to the closest line float d2=100 ;the distance to the second closest line int l1=0 ;the closest line int l2=0 ;the second closest line int n n=0 Repeat n=n+1 ; the folowing section is taken from Kerry's "Line" - lkm ;replaced #z with z t=(z-d[n,1])/(d[n,0]-d[n,1]) x=real(t) y=imag(t) if(x<0.0) rr=sqr(x)+sqr(y) elseif(x>1.0) rr=sqr(x-1.0)+sqr(y) else rr=sqr(y) endif rr=sqrt(rr)*cabs(d[n,0]-d[n,1]) ;this was the last line from Kerry's code; if (rr1)||(real(z)<0)||(imag(z)>1)||(imag(z)<0)) #solid=true endif If @d3d if ((simetry) && (l2!=0)) int temp=l1, l1=l2, l2=temp endif If @tip==0 ; if ((l1==6) && (l2==1))||((l1==4) && (l2==5)) d1=d2 endif endif If @tip==1 ; if (l1==11) && (l2==12) d1=d2 endif endif If @tip==2 ; if ((l1==1) && (l2==14))||((l1==11) && (l2==10))||((l1==5) && (l2==12))||((l1==13) && (l2==6))||((l1==8) && (l2==3)) d1=d2 endif endif If @tip==3 ; if ((l1==7) && (l2==1))||((l1==2) && (l2==13))||((l1==14) && (l2==8))||((l1==8) && (l2==2))||((l1==5) && (l2==8))||((l1==2) && (l2==5))||((l1==13) && (l2==7))||((l1==8) && (l2==9))||((l1==6) && (l2==7))||((l1==7) && (l2==10))||((l1==11) && (l2==13))||((l1==10) && (l2==5))||((l1==10) && (l2==13)) d1=d2 endif endif If @tip==4 ; if ((l1==1) && (l2==2))||((l1==3) && (l2==4))||((l1==5) && (l2==8))||((l1==7) && (l2==6)) d1=d2 endif endif If @tip==5 ; if ((l1==5) && (l2==2)) d1=d2 endif endif If @tip==6 ; if ((l1==2) && (l2==16))||((l1==40) && (l2==4))||((l1==5) && (l2==53))||((l1==55) && (l2==7))||((l1==30) && (l2==57))||((l1==51) && (l2==28))||((l1==27) && (l2==12))||((l1==11) && (l2==42))||((l1==18) && (l2==9))||((l1==58) && (l2==59))||((l1==20) && (l2==19))||((l1==24) && (l2==21))||((l1==43) && (l2==26))||((l1==34) && (l2==45))||((l1==48) && (l2==35))||((l1==13) && (l2==50))||((l1==60) && (l2==15))||((l1==37) && (l2==62))||((l1==32) && (l2==23))||((l1==46) && (l2==47))||((l1==54) && (l2==39)) d1=d2 endif endif If @tip==7 ; if ((l1==8) && (l2==7))||((l1==4) && (l2==3))||((l1==1) && (l2==11))||((l1==11) && (l2==10)) d1=d2 endif endif If @tip==8 ; if ((l1==9) && (l2==10))||((l1==6) && (l2==7))||((l1==3) && (l2==4))||((l1==12) && (l2==1)) d1=d2 endif endif If @tip==9 ; if ((l1==1) && (l2==14))||((l1==14) && (l2==16))||((l1==16) && (l2==22))||((l1==19) && (l2==16))||((l1==16) && (l2==5))||((l1==5) && (l2==4))||((l1==7) && (l2==8))||((l1==11) && (l2==12))||((l1==7) && (l2==8)) d1=d2 endif endif If @tip==10 ; if ((l1==1) && (l2==30))||((l1==5) && (l2==4))||((l1==17) && (l2==6))||((l1==7) && (l2==8))||((l1==10) && (l2==21))||((l1==19) && (l2==16))||((l1==29) && (l2==18))||((l1==27) && (l2==28))||((l1==14) && (l2==25))||((l1==24) && (l2==13))||((l1==23) && (l2==24))||((l1==13) && (l2==22))||((l1==22) && (l2==11))||((l1==11) && (l2==12)) d1=d2 endif endif If @tip==11 ; if ((l1==2) && (l2==3))||((l1==6) && (l2==15))||((l1==30) && (l2==9))||((l1==34) && (l2==33))||((l1==38) && (l2==37))||((l1==12) && (l2==41))||((l1==44) && (l2==63))||((l1==48) && (l2==47))||((l1==60) && (l2==28))||((l1==18) && (l2==57))||((l1==53) && (l2==21))||((l1==25) && (l2==50)) d1=d2 endif endif If @tip==12 ; if ((l1==6) && (l2==7))||((l1==8) && (l2==16))||((l1==15) && (l2==5))||((l1==4) && (l2==3))||((l1==10) && (l2==9))||((l1==14) && (l2==11))||((l1==12) && (l2==1))||((l1==2) && (l2==13)) d1=d2 endif endif If @tip==13 ; if ((l1==40) && (l2==1))||((l1==13) && (l2==39))||((l1==16) && (l2==15))||((l1==15) && (l2==37))||((l1==7) && (l2==14))||((l1==12) && (l2==41))||((l1==2) && (l2==43))||((l1==44) && (l2==18))||((l1==17) && (l2==8))||((l1==37) && (l2==17))||((l1==8) && (l2==36))||((l1==19) && (l2==3))||((l1==21) && (l2==20))||((l1==52) && (l2==21))||((l1==4) && (l2==52))||((l1==36) && (l2==45))||((l1==53) && (l2==35))||((l1==45) && (l2==9))||((l1==9) && (l2==54))||((l1==54) && (l2==46))||((l1==46) && (l2==47))||((l1==22) && (l2==4))||((l1==34) && (l2==22))||((l1==48) && (l2==10))||((l1==23) && (l2==49))||((l1==5) && (l2==34))||((l1==11) && (l2==24))||((l1==25) && (l2==26))||((l1==51) && (l2==31))||((l1==33) && (l2==51))||((l1==31) && (l2==33))||((l1==6) && (l2==30))||((l1==50) && (l2==5))||((l1==29) && (l2==28))||((l1==27) && (l2==12)) d1=d2 endif endif If @tip==14 ; if ((l1==23) && (l2==1))||((l1==2) && (l2==11))||((l1==10) && (l2==17))||((l1==18) && (l2==24))||((l1==24) && (l2==10))||((l1==9) && (l2==8))||((l1==3) && (l2==24))||((l1==2) && (l2==4))||((l1==17) && (l2==2))||((l1==11) && (l2==23))||((l1==22) && (l2==16))||((l1==19) && (l2==11))||((l1==12) && (l2==13))||((l1==6) && (l2==7))||((l1==4) && (l2==21))||((l1==21) && (l2==20))||((l1==19) && (l2==4))||((l1==15) && (l2==19))||((l1==13) && (l2==5))||((l1==4) && (l2==13))||((l1==5) && (l2==15)) d1=d2 endif endif If @tip==15 ; if ((l1==1) && (l2==11))||((l1==11) && (l2==14))||((l1==5) && (l2==11))||((l1==11) && (l2==7))||((l1==15) && (l2==11))||((l1==11) && (l2==6))||((l1==8) && (l2==11))||((l1==3) && (l2==2))||((l1==3) && (l2==7))||((l1==3) && (l2==12))||((l1==14) && (l2==3))||((l1==3) && (l2==8))||((l1==13) && (l2==3))||((l1==3) && (l2==15))||((l1==14) && (l2==7))||((l1==12) && (l2==7))||((l1==14) && (l2==5))||((l1==5) && (l2==15))||((l1==15) && (l2==8))||((l1==12) && (l2==15))||((l1==15) && (l2==13))||((l1==7) && (l2==15))||((l1==15) && (l2==6))||((l1==6) && (l2==7))||((l1==7) && (l2==10))||((l1==6) && (l2==8))||((l1==16) && (l2==6))||((l1==8) && (l2==5))||((l1==7) && (l2==5))||((l1==12) && (l2==14))||((l1==8) && (l2==12))||((l1==8) && (l2==14))||((l1==13) && (l2==8))||((l1==14) && (l2==13))||((l1==4) && (l2==14))||((l1==13) && (l2==3))||((l1==5) && (l2==12))||((l1==12) && (l2==16))||((l1==9) && (l2==5))||((l1==5) && (l2==16))||((l1==16) && (l2==9))||((l1==9) && (l2==12))||((l1==13) && (l2==9)) d1=d2 endif endif If @tip==16 ; if ((l1==2) && (l2==13))||((l1==12) && (l2==20))||((l1==20) && (l2==16))||((l1==11) && (l2==10))||((l1==17) && (l2==9))||((l1==22) && (l2==17))||((l1==9) && (l2==23))||((l1==15) && (l2==8))||((l1==8) && (l2==7))||((l1==6) && (l2==24))||((l1==24) && (l2==25))||((l1==4) && (l2==5))||((l1==19) && (l2==3))||((l1==26) && (l2==19))||((l1==3) && (l2==21))||((l1==1) && (l2==2))||((l1==21) && (l2==1))||((l1==14) && (l2==18))||((l1==23) && (l2==15)) d1=d2 endif endif If @tip==17 ; if ((l1==1) && (l2==39))||((l1==39) && (l2==10))||((l1==10) && (l2==2))||((l1==38) && (l2==9))||((l1==22) && (l2==52))||((l1==9) && (l2==22))||((l1==9) && (l2==51))||((l1==6) && (l2==7))||((l1==41) && (l2==5))||((l1==3) && (l2==23))||((l1==2) && (l2==38))||((l1==21) && (l2==24))||((l1==37) && (l2==40))||((l1==11) && (l2==12))||((l1==13) && (l2==43))||((l1==44) && (l2==36))||((l1==19) && (l2==45))||((l1==41) && (l2==20))||((l1==25) && (l2==42))||((l1==35) && (l2==14))||((l1==47) && (l2==34))||((l1==33) && (l2==32))||((l1==46) && (l2==28))||((l1==27) && (l2==26))||((l1==50) && (l2==46))||((l1==28) && (l2==49))||((l1==49) && (l2==18))||((l1==15) && (l2==48))||((l1==29) && (l2==16))||((l1==16) && (l2==17))||((l1==31) && (l2==30))||((l1==18) && (l2==29)) d1=d2 endif endif endif if (l1==0) #solid=true endif #index=d1/@thick default: title = "Arabic Tilings" int param tip caption = "Type" hint = "This is type of tilling. Just choose one model." enum = "Squares" "Elongated hexagons" "X-Cross" "Mudejar" "Hexagons" "Bones" "Birds" "Comores" "Comores 2" "Courtyard of Lions" "Captive Princess Tower" "Rectilling" "Hexagonal stars" "Soare" "12 Pointed Stars" "Lines" "No. 5" "No. 7" default = 10 endparam float param thick caption = "Thickness" hint = "How thick the lines are" default = .02 endparam bool param d3d caption = "Interlaced" hint = "Whether the tiling will be rendered interlaced." default = true endparam int param mod caption = "Mode" hint = "Change this to see how the original model looks like." enum = "All Tiles" "One Tile Uncut" "One Tile Cut" default = 0 endparam } RobertMay { ; This coloring method implements Robert May's formula ; r*(1-x)*x; ; don't rotate the image global: $define debug bool mat[#width+3,#height+3] ;a boolean matrix for pixels that have been "hit" int i, int j, int n, int n1, int n2 ;just counters int grosime=@gros ; axis and points thickness float r ; the parameter (r*x*(1-x)) ;compute corners If (#width/#height)<(4/3) float k=4/#magn ;length float st=real(#center)-k/2 ;left float dr=st+k ;right k=k*#height/#width float sus=imag(#center)+k/2 ;up float jos=sus-k ;down Else float k=3/#magn ;length float sus=imag(#center)+k/2 ;up float jos=sus-k ;down k=k*#width/#height float st=real(#center)-k/2 ;left float dr=st+k ;right endif ;initialize the "hit matrix" with false i=0 repeat i=i+1 j=0 repeat j=j+1 mat[i,j]=false until j==#height+1 until i==#width+1 float rez ; the x from the formula If @tip==true ;that is explorer mode i=0; repeat i=i+1 j=0 rez=0.5 ;initialize with a value between 0 and 1 r=st+(i-1)*(dr-st)/(#width+1) ;compute r=real(pixel) If (r>0) && (r<=4) ; the only values that make sense repeat ;skipping some iterations to aproach the limit j=j+1 rez=r*rez*(1-rez) until j==@burn j=0 repeat ;actual iterations j=j+1 rez=r*rez*(1-rez) n=round((#height)*(rez-jos)/(sus-jos)-1) If (n<#height)&&(n>0) ;it is inside the screen mat[i,#height-n]=true ;the pixel that has been hit endif until j==@iter endif until i==#width endif if @tip==false ; the Standard mode r=real(@seed) ; rez=imag(@seed) ;initializing the starting value and r j=0 repeat j=j+1 rez=r*rez*(1-rez) until j==@burn2 ;skipped iterations to aproach the limit i=0 repeat i=i+1; rez=r*rez*(1-rez) n=round((#height)*(rez-jos)/(sus-jos)-1) If (n<#height)&&(n>0) mat[round(i*#width/@iter2),#height-n]=true ;the pixel that has been hit n1=-1 repeat n1=n1+1 n2=-1 repeat n2=n2+1 mat[round(i*#width/@iter2)+n1,#height-n+n2]=true ;making the point thicker until n2==@gros until n1==@gros endif until i==@iter2 endif init: loop: final: if mat[#x+1,#y+1]==false #color=gradient(0.01*#numiter) ;pixels that weren't hit else #color=rgba(0,0,0,0)+@col1;pixel that was hit endif If @tip==true If (real(#pixel)<0) && (abs(real(#pixel))4) && (abs(real(#pixel)-4)1) && (abs(imag(#pixel)-1)1.0) rr=sqr(x-1.0)+sqr(y) else rr=sqr(y) endif rr=sqrt(rr)*cabs(drepte[1,2]-drepte[1,1]) ;this was the last line from Kerry's code m=rr float d1=100 ;the distance to the closest line float d2=100 ;the distance to the second closest line int l1=0 ;the closest line int n n=0 Repeat n=n+1 ; the folowing section is taken from Kerry's "Line" - lkm t=(#z-drepte[n,1])/(drepte[n,2]-drepte[n,1]) x=real(t) y=imag(t) if(x<0.0) rr=sqr(x)+sqr(y) elseif(x>1.0) rr=sqr(x-1.0)+sqr(y) else rr=sqr(y) endif rr=sqrt(rr)*cabs(drepte[n,2]-drepte[n,1]) ;this was the last line from Kerry's code; if rr0.9) #solid=true endif endif default: title = "Rotational patterns" heading caption = "General Settings:" endheading float param stretch caption = "Stretch" hint = "Streches the figure(x/y)" min=0.000000000001 max=1000000 default = 1 endparam int param tip caption = "Initial figure" hint = "This is 'seed' of the figure" enum = "Line" "Triangle" "Diamond" "Pentagon" "Hexagon" "Heptagon" "Octogon" "Octogon+Square" "Hexagon+Triangle" "Dodecagon" "Square+Diagonals" "Pentagon+SmallDiagonals" "Hexagon+SmallDiagonals" "Octogon+SDiagonals" "Square" "Icosagon" default = 8 endparam bool param q caption = "Colored" hint = "Colors the final shape." default = false endparam int param nc caption = "Number of colors" hint = "This is the number of colors used." default = 4 min=2 visible=(@q==true) endparam float param edge caption = "Edge thickness" hint = "Just that." default =0.02 min=0 max=1; visible=(@q==true) endparam bool param solid caption = "Solid" hint = "One color or part of the gradient" default = true visible=(@q==true) endparam heading caption = "1st transformation:" endheading int param r1 caption = "Number of rotations" hint = "This is the number the figure is rotated." default = 1 min = 1 max = 50 endparam complex param c1 caption = "Center of rotation" hint = "This is the center around which the figure is rotated." default = 0+0i endparam heading caption = "2nd transformation:" endheading int param r2 caption = "Number of rotations" hint = "This is the number the figure is rotated." default = 1 min = 1 max = 50 endparam complex param c2 caption = "Center of rotation" hint = "This is the center around which the figure is rotated." default = 0+0i endparam heading caption = "3rd transformation:" endheading int param r3 caption = "Number of rotations" hint = "This is the number the figure is rotated." default = 1 min = 1 max = 50 endparam complex param c3 caption = "Center of rotation" hint = "This is the center around which the figure is rotated." default = 0+0i endparam heading caption = "4th transformation:" endheading int param r4 caption = "Number of rotations" hint = "This is the number the figure is rotated." default = 1 min = 1 max = 50 endparam complex param c4 caption = "Center of rotation" hint = "This is the center around which the figure is rotated." default = 0+0i endparam heading caption = "5th transformation:" endheading int param r5 caption = "Number of rotations" hint = "This is the number the figure is rotated." default = 1 min = 1 max = 50 endparam complex param c5 caption = "Center of rotation" hint = "This is the center around which the figure is rotated." default = 0+0i endparam heading caption = "6th transformation:" endheading int param r6 caption = "Number of rotations" hint = "This is the number the figure is rotated." default = 1 min = 1 max = 50 endparam complex param c6 caption = "Center of rotation" hint = "This is the center around which the figure is rotated." default = 0+0i endparam heading caption = "7th transformation:" endheading int param r7 caption = "Number of rotations" hint = "This is the number the figure is rotated." default = 1 min = 1 max = 50 endparam complex param c7 caption = "Center of rotation" hint = "This is the center around which the figure is rotated." default = 0+0i endparam } L-systems { ;use 4 and 6 as + - ;set 7,8,9 for "turtle up","turtle down" or "ignore ;if you get a compiller message saying array index out of bounds ; -generator = 1 or 9 and "use 9,1 as []" checked ; -increase "points" ;if you get a long line and the compiller doesn't give the previous warning it means that your rule is too long (15 decimals max). ;if you want to force uf to work with longer rules you have to set the aditional precision in the formul tab to the desired value.This will slow things down. global: $define debug complex d[@points,2] ; lines int v1[@points] ;string vector 1 int v2[@points] ;string vector 2 float rules[10] ; the rules float rule rules[1] = @r1 rules[2] = @r2 rules[3] = @r3 rules[4] = .4 rules[5] = @r5 rules[6] = .6 rules[7] = @r7 rules[8] = @r8 rules[9] = @r9 if (@paranteze==true) rules[1]=0.1 rules[9]=0.9 endif complex stiva[trunc(@points/2)];//pct float stiva2[trunc(@points/2)];//angle int varf=0; int i=0 int n=0; number of points in string vector float generator=@generator repeat i=i+1 ;print(generator) v1[i]= trunc(generator * 10 + 0.01); n=n+1 generator = generator*10-v1[i]; until (generator < 0.01) int j=0 ; v2's counter int k=0 ; number of stages repeat k=k+1 j=0 i=0 ; the length of the string v1 repeat i=i+1 rule=rules[v1[i]] repeat j=j+1 v2[j]= trunc(rule * 10 + 0.01);for fixing float errors rule = rule*10- v2[j]; until (rule < 0.01) until (i==n) ; transfering v2 to v1 n=j j=0 repeat j=j+1 v1[j]=v2[j] until (j==n) until (k==@stages) complex pct=0 float angle=0 j=0 ;for v1 i=0 ;for d repeat j=j+1 if (v1[j]==4) angle=angle + @angle/180*#pi endif if (v1[j]==6) angle=angle - @angle/180*#pi endif if (v1[j]==1&&(@paranteze==false))||(v1[j]==2)||(v1[j]==3)||(v1[j]==5)||((v1[j]==7)&&(@ru7==0))||((v1[j]==8)&&(@ru8==0))||((v1[j]==9)&&(@ru9==0)&&(@paranteze==false)) i=i+1 d[i,0]=pct pct=pct+@l*(cos(angle)+flip(sin(angle))) d[i,1]=pct endif if ((v1[j]==9)&&(@ru9==1))&&(@paranteze==false) pct=pct+@l*(cos(angle)+flip(sin(angle))) endif if (((v1[j]==8)&&(@ru8==1))||((v1[j]==7)&&(@ru7==1))) pct=pct+@l*(cos(angle)+flip(sin(angle))) endif if ((v1[j]==1)&&(@paranteze==true)) if (varf==0) print("Error more ')' than '('") endif pct=stiva[varf] angle=stiva2[varf] varf=varf-1 endif if ((v1[j]==9)&&(@paranteze==true)) varf=varf+1 stiva[varf]=pct stiva2[varf]=angle endif until (j==n) init: ; the folowing section is taken from Kerry's "Line" - lkm ; I've changed variable "r" to "rr" float rr=0.0 ;distance to segment float x=0.0 float y=0.0 float rr=0.0 t=(0,0) final: float min=1000 ;the distance to the nearest line int ii=0 repeat ii=ii+1 t=(#z-d[ii,0])/(d[ii,1]-d[ii,0]) x=real(t) y=imag(t) if(x<0.0) rr=sqr(x)+sqr(y) elseif(x>1.0) rr=sqr(x-1.0)+sqr(y) else rr=sqr(y) endif rr=sqrt(rr)*cabs(d[ii,1]-d[ii,0]) ;this was the last line from Kerry's code if ((rr<@thick) && (rr@thick) #solid=true endif #index=min/@thick default: title = "L-systems" int param points caption = "Points" default = 500 min = 0 hint="No of points used to generate the lines.Keep it as low as possible.Increase it if you get a message that says array index out of bounds" endparam int param stages caption = "Stages" default = 1 min = 0 endparam float param angle caption = "Angle" max=180 default = 90 min = 0 endparam float param l caption = "Line-length" default = .1 min=0 endparam float param thick caption = "Line-width" default = .05 endparam heading caption = "Rules" endheading float param generator caption = "Generator" hint = "The generator" default = .5 min = 0 max = 1 endparam float param r1 caption = "Rule 1" default = .1 min = 0.01 max = 1 visible=(@paranteze==false); endparam float param r2 caption = "Rule 2" default = .2 min = 0.01 max = 1 endparam float param r3 caption = "Rule 3" default = .3 min = 0.01 max = 1 endparam float param r5 caption = "Rule 5" default = .5 min = 0.01 max = 1 endparam float param r7 caption = "Rule 7" default = .7 min = 0.01 max = 1 endparam float param r8 caption = "Rule 8" default = .8 min = 0.01 max = 1 endparam float param r9 caption = "Rule 9" default = .9 min = 0.1 max = 1 visible=(@paranteze==false); endparam heading caption = "Special rules" endheading bool param paranteze Caption = "Use '9','1' as '[',']'" default = false endparam int param ru9 Caption = "Use rule 9" default = 1 enum="Turtle down" "Turtle up" "Don't draw" visible=(@paranteze==false); endparam int param ru8 Caption = "Use rule 8" default = 0 enum="Turtle down" "Turtle up" "Don't draw" endparam int param ru7 Caption = "Use rule 7" default = 0 enum="Turtle down" "Turtle up" "Don't draw" endparam } ComplexSphere { global: $define debug ;initializing some basic Perlin noise stuff int i; int j; int temp; int p[257]; float g[257]; float max; int seed=@seed; i=0 repeat i=i+1 p[i]=i seed = random(seed) g[i]=seed/#randomrange until i==256 i=-1 repeat i=i+1 seed = random(seed) j= abs(seed) % 255 +1; temp=p[i]; p[i]=p[j]; p[j]=temp; until i==255 float fract1=1 float max=0; i=0 repeat i=i+1 max= max + fract1*real(@f1(@persistenta^(i-1))); fract1=fract1*@fract until i==@octave max=real(@f2(max)) init: ; one line : Vstart+Vdir(ection)*t float startx=real(#pixel) float starty=imag(#pixel) float startz=-100 float dirx=0 float diry=0 float dirz=1 ; one sphere: (px-cx)^2+(py-cy)^2+(pz-cz)^2=r^2 float cx=real(@center) float cy=imag(@center) float cz=@centerz ; the modifiers float qqx=@qqx float qqy=@qqy float qqz=@qqz ;rotating the modifiers ;float beta=atan2(qqx+flip(qqz)); ;beta=beta+@rot*pi/180 ;float qqx=sqrt(qqx*qqx+qqz*qqz)*cos(beta) ;float qqy=qqy; ;float qqz=sqrt(qqx*qqx+qqz*qqz)*sin(beta) ;do the line and the sphere meet float delta=4*(dirx*qqx*(startx-cx)+diry*qqy*(starty-cy)+dirz*qqz*(startz-cz))^2 ;just dividing delta on two lines delta=delta-4*(qqx*qqx*sqr(startx-cx)+qqy*qqy*sqr(starty-cy)+qqz*qqz*sqr(startz-cz)-@r^2) if (@type==0) ;sphere if (delta>=0) ;they do meet float t1=(-2*(dirx*qqx*(startx-cx)+diry*qqy*(starty-cy)+dirz*qqz*(startz-cz))-sqrt(delta))/2 float t2=(-2*(dirx*qqx*(startx-cx)+diry*qqy*(starty-cy)+dirz*qqz*(startz-cz))+sqrt(delta))/2 float t if (t1@upb || noise<@lowb)&&(@where==1) && @what==0) noise=0 endif if ((noise<@upb && noise>@lowb)&&(@where==0) && @what==0) noise=0 endif if ((noise>@upb)&&(@where==1) && @what==1) noise=@upb endif if ((noise<@lowb)&&(@where==1) && @what==1) noise=@lowb endif if ((noise<@upb && noise>@lowb)&&(@where==0) && @what==1) noise=@lowb endif nx=nx+@size*noise if (@mode==0) ;just leaving out some unnecesary computations ; modifing the normal y axis rx=sqrt(intx*intx+intz*intz)*cos(alfa)*@scale; ry=inty*@scale; rz=sqrt(intx*intx+intz*intz)*sin(alfa)*@scale; noise=0; k=0; fract=1 repeat k=k+1 rx=rx*2; ry=ry*2; rz=rz*2; x=floor(rx); y=floor(ry); z=floor(rz); xx=x+1; yy=y+1; zz=z+1; pcte[1]=g[abs(x+p[abs(y+p[p[abs(z % 255) + 1]])% 255 + 1])% 255 + 1]; pcte[2]=g[abs(x+p[abs(y+p[p[abs(zz % 255) + 1]])% 255 + 1])% 255 + 1]; pcte[3]=g[abs(x+p[abs(yy+p[p[abs(z % 255) + 1]])% 255 + 1])% 255 + 1]; pcte[4]=g[abs(x+p[abs(yy+p[p[abs(zz % 255) + 1]])% 255 + 1])% 255 + 1]; pcte[5]=g[abs(xx+p[abs(y+p[p[abs(z % 255) + 1]])% 255 + 1])% 255 + 1]; pcte[6]=g[abs(xx+p[abs(y+p[p[abs(zz % 255) + 1]])% 255 + 1])% 255 + 1]; pcte[7]=g[abs(xx+p[abs(yy+p[p[abs(z % 255) + 1]])% 255 + 1])% 255 + 1]; pcte[8]=g[abs(xx+p[abs(yy+p[p[abs(zz % 255) + 1]])% 255 + 1])% 255 + 1]; if @interpolare == 1 ;interpolare z f=(rz-z)*pi; ff=(1-cos(f))*0.5; pcte[1]=(1-ff)*pcte[1]+ff*pcte[2]; pcte[2]=(1-ff)*pcte[3]+ff*pcte[4]; pcte[3]=(1-ff)*pcte[5]+ff*pcte[6]; pcte[4]=(1-ff)*pcte[7]+ff*pcte[8]; ;interpolare y f=(ry-y)*pi; ff=(1-cos(f))*0.5; pcte[1]=(1-ff)*pcte[1]+ff*pcte[2]; pcte[2]=(1-ff)*pcte[3]+ff*pcte[4]; ;interpolare x f=(rx-x)*pi; ff=(1-cos(f))*0.5; pcte[1]=(1-ff)*pcte[1]+ff*pcte[2]; endif; if @interpolare == 0 ;interpolare z f=rz-z; pcte[1]=(1-f)*pcte[1]+f*pcte[2]; pcte[2]=(1-f)*pcte[3]+f*pcte[4]; pcte[3]=(1-f)*pcte[5]+f*pcte[6]; pcte[4]=(1-f)*pcte[7]+f*pcte[8]; ;interpolare y f=ry-y; pcte[1]=(1-f)*pcte[1]+(f)*pcte[2]; pcte[2]=(1-f)*pcte[3]+(f)*pcte[4]; ;interpolare x f=rx-x; pcte[1]=(1-f)*pcte[1]+f*pcte[2]; endif; if @interpolare == 2 f=zz-rz; ff=1-f; ;interpolare z pcte[1]=(3*f*f-2*f*f*f)*pcte[1]+(3*ff*ff-2*ff*ff*ff)*pcte[2]; pcte[2]=(3*f*f-2*f*f*f)*pcte[3]+(3*ff*ff-2*ff*ff*ff)*pcte[4]; pcte[3]=(3*f*f-2*f*f*f)*pcte[5]+(3*ff*ff-2*ff*ff*ff)*pcte[6]; pcte[4]=(3*f*f-2*f*f*f)*pcte[7]+(3*ff*ff-2*ff*ff*ff)*pcte[8]; f=yy-ry; ff=1-f; ;interpolare y pcte[1]=(3*f*f-2*f*f*f)*pcte[1]+(3*ff*ff-2*ff*ff*ff)*pcte[2]; pcte[2]=(3*f*f-2*f*f*f)*pcte[3]+(3*ff*ff-2*ff*ff*ff)*pcte[4]; f=xx-rx; ff=1-f; ;interpolare ; pcte[1]=(3*f*f-2*f*f*f)*pcte[1]+(3*ff*ff-2*ff*ff*ff)*pcte[2]; endif; if @alterare == 0 noise = noise+fract*real(@f1(pcte[1]*@persistenta^(k-1))); endif if @alterare == 1 noise = noise+fract*real(@f1(abs(pcte[1]*@persistenta^(k-1)))); endif if @alterare == 2 noise = noise+fract*real(@f1(abs(pcte[1]*@persistenta^(k-1)))); endif fract=fract*@fract until k==@octave; if @alterare==2 noise=real(@f2(sin(real(#pixel)+noise))); endif noise=noise/max if ((noise>@upb || noise<@lowb)&&(@where==1) && @what==0) noise=0 endif if ((noise<@upb || noise>@lowb)&&(@where==0) && @what==0) noise=0 endif if ((noise>@upb)&&(@where==1) && @what==1) noise=@upb endif if ((noise<@lowb)&&(@where==1) && @what==1) noise=@lowb endif if ((noise<@upb && noise>@lowb)&&(@where==0) && @what==1) noise=@lowb endif ny=ny+@size*noise ; modifing the normal z axis rx=sqrt(intx*intx+intz*intz)*cos(alfa)*@scale; ry=inty*@scale; rz=sqrt(intx*intx+intz*intz)*sin(alfa)*@scale; noise=0; k=0; repeat k=k+1 rx=rx*2; ry=ry*2; rz=rz*2; x=floor(rx); y=floor(ry); z=floor(rz); xx=x+1; yy=y+1; zz=z+1; pcte[1]=g[abs(x+p[abs(y+p[p[p[abs(z % 255) + 1]]])% 255 + 1])% 255 + 1]; pcte[2]=g[abs(x+p[abs(y+p[p[p[abs(zz % 255) + 1]]])% 255 + 1])% 255 + 1]; pcte[3]=g[abs(x+p[abs(yy+p[p[p[abs(z % 255) + 1]]])% 255 + 1])% 255 + 1]; pcte[4]=g[abs(x+p[abs(yy+p[p[p[abs(zz % 255) + 1]]])% 255 + 1])% 255 + 1]; pcte[5]=g[abs(xx+p[abs(y+p[p[p[abs(z % 255) + 1]]])% 255 + 1])% 255 + 1]; pcte[6]=g[abs(xx+p[abs(y+p[p[p[abs(zz % 255) + 1]]])% 255 + 1])% 255 + 1]; pcte[7]=g[abs(xx+p[abs(yy+p[p[p[abs(z % 255) + 1]]])% 255 + 1])% 255 + 1]; pcte[8]=g[abs(xx+p[abs(yy+p[p[p[abs(zz % 255) + 1]]])% 255 + 1])% 255 + 1]; if @interpolare == 1 ;interpolare z f=(rz-z)*pi; ff=(1-cos(f))*0.5; pcte[1]=(1-ff)*pcte[1]+ff*pcte[2]; pcte[2]=(1-ff)*pcte[3]+ff*pcte[4]; pcte[3]=(1-ff)*pcte[5]+ff*pcte[6]; pcte[4]=(1-ff)*pcte[7]+ff*pcte[8]; ;interpolare y f=(ry-y)*pi; ff=(1-cos(f))*0.5; pcte[1]=(1-ff)*pcte[1]+ff*pcte[2]; pcte[2]=(1-ff)*pcte[3]+ff*pcte[4]; ;interpolare x f=(rx-x)*pi; ff=(1-cos(f))*0.5; pcte[1]=(1-ff)*pcte[1]+ff*pcte[2]; endif; if @interpolare == 0 ;interpolare z f=rz-z; pcte[1]=(1-f)*pcte[1]+f*pcte[2]; pcte[2]=(1-f)*pcte[3]+f*pcte[4]; pcte[3]=(1-f)*pcte[5]+f*pcte[6]; pcte[4]=(1-f)*pcte[7]+f*pcte[8]; ;interpolare y f=ry-y; pcte[1]=(1-f)*pcte[1]+(f)*pcte[2]; pcte[2]=(1-f)*pcte[3]+(f)*pcte[4]; ;interpolare x f=rx-x; pcte[1]=(1-f)*pcte[1]+f*pcte[2]; endif; if @interpolare == 2 f=zz-rz; ff=1-f; ;interpolare z pcte[1]=(3*f*f-2*f*f*f)*pcte[1]+(3*ff*ff-2*ff*ff*ff)*pcte[2]; pcte[2]=(3*f*f-2*f*f*f)*pcte[3]+(3*ff*ff-2*ff*ff*ff)*pcte[4]; pcte[3]=(3*f*f-2*f*f*f)*pcte[5]+(3*ff*ff-2*ff*ff*ff)*pcte[6]; pcte[4]=(3*f*f-2*f*f*f)*pcte[7]+(3*ff*ff-2*ff*ff*ff)*pcte[8]; f=yy-ry; ff=1-f; ;interpolare y pcte[1]=(3*f*f-2*f*f*f)*pcte[1]+(3*ff*ff-2*ff*ff*ff)*pcte[2]; pcte[2]=(3*f*f-2*f*f*f)*pcte[3]+(3*ff*ff-2*ff*ff*ff)*pcte[4]; f=xx-rx; ff=1-f; ;interpolare ; pcte[1]=(3*f*f-2*f*f*f)*pcte[1]+(3*ff*ff-2*ff*ff*ff)*pcte[2]; endif; if @alterare == 0 noise = noise+fract*real(@f1(pcte[1]*@persistenta^(k-1))); endif if @alterare == 1 noise = noise+fract*real(@f1(abs(pcte[1]*@persistenta^(k-1)))); endif if @alterare == 2 noise = noise+fract*real(@f1(abs(pcte[1]*@persistenta^(k-1)))); endif fract=fract*@fract until k==@octave; if @alterare==2 noise=real(@f2(sin(real(#pixel)+noise))); endif noise=noise/max if ((noise>@upb || noise<@lowb)&&(@where==1) && @what==0) noise=0 endif if ((noise<@upb || noise>@lowb)&&(@where==0) && @what==0) noise=0 endif if ((noise>@upb)&&(@where==1) && @what==1) noise=@upb endif if ((noise<@lowb)&&(@where==1) && @what==1) noise=@lowb endif if ((noise<@upb && noise>@lowb)&&(@where==0) && @what==1) noise=@lowb endif nz=nz+@size*noise ;finished tweaking the normal ; renormalizing the normal float ddist=sqrt(nx*nx+ny*ny+nz*nz) nx=nx/ddist; ny=ny/ddist; nz=nz/ddist; endif if (t>0) bool yes=true else bool yes=false endif final: if (yes) ; light vector float dist=sqrt((real(@lc)-intx)^2+(imag(@lc)-inty)^2+(@lcz-intz)^2) float lx=(real(@lc)-intx)/dist float ly=(imag(@lc)-inty)/dist float lz=(@lcz-intz)/dist ;light angle float angle=(nx*lx+ny*ly+nz*lz) ;I need an angle betwen 0 and 1; this one is between -1 and 1 angle=(angle+1)/2 ;aparently gradient(0.99...)=gradient(0) if (angle>0.99) angle=0.99 endif ; the reflected ray float reflx=((nx*dirx)+(ny*diry)+(nz*dirz))*nx-dirx float refly=((nx*dirx)+(ny*diry)+(nz*dirz))*ny-diry float reflz=((nx*dirx)+(ny*diry)+(nz*dirz))*nz-dirz float phong=reflx*lx+refly*ly+reflz*lz phong=-phong if (phong<0) phong=0 endif if (@mode==0) #color=mergeaddition(gradient(angle),rgb(red(@phong)*phong^@specular,green(@phong)*phong^@specular,blue(@phong)*phong^@specular)) else #color=gradient(noise/max) endif else #solid=true endif default: title = "Complex Sphere" int param type enum="Sphere" "Plane" default=0 Caption="Object" Hint="Plane or Sphere" endparam heading caption="Sphere" visible=(@type==0) endheading complex param center default=0 visible=(@type==0) caption="Center" Hint="The x and y coordinates of the sphere" endparam float param centerz default=0 visible=(@type==0) caption="Center z-axis" Hint="The 3rd coordinate for the sphere" endparam float param r default=1.5 visible=(@type==0) caption="Radius" endparam float param size default=1 caption="Bump size" visible=(@mode==0) hint="The size of the bumps" endparam float param rot default=0 caption="Rotation" hint="The sphere can be rotated; this is great for movies" endparam float param specular default=.5 caption="Specular power" visible=(@mode==0) hint="a number that shows how shiny the sphere is" endparam color param phong default=rgb(1,1,1) caption="Light color" visible=(@mode==0) hint="The color of the light; use white" endparam int param mode default=0 Caption="Mode" enum="Shading" "Texture" hint="Texture results in a ball colored with Perlin noise; Shading results in a sphere with bumps." endparam bool param show default=false visible=(@type==0) Caption="Show modifiers" hint="These modifiers help you make an elipsoid instead of a sphere" endparam heading caption="Sphere modifiers" visible=(@show==true)&&(@type==0) endheading float param qqx caption="X" default=1 visible=(@show==true)&&(@type==0) endparam float param qqy caption="Y" default=1 visible=(@show==true)&&(@type==0) endparam float param qqz caption="Z" default=1 visible=(@show==true)&&(@type==0) endparam heading caption="Light position" visible=(@mode==0) endheading complex param lc ;enter default=10 caption="Light center" visible=(@mode==0) hint="Where is the light source?" endparam float param lcz default=-40 caption="Light center z-axis" visible=(@mode==0) endparam heading caption="Perlin" endheading int param octave caption = "Octaves" default = 1 min = 1 endparam float param persistenta caption = "Persistence" default = .6 endparam float param fract caption = "Fractal dimension" default = 1 endparam int param interpolare caption = "Interpolation." enum = "Linear" "Cosine" "Cubic" default = 2 hint="Just use cubic for best results" endparam int param alterare caption = "Alter by" enum = "None" "Turbulence" "Sinus" default = 0 endparam float param scale default=1 caption="Scale" endparam int param seed default=123456 caption="Seed" endparam heading caption = "Bounds:" endheading float param upb default=1 caption="UpperBound" hint="Define the upper and lower bounds of the noise; see 'What to do?'" endparam float param lowb default=-1 caption="LowerBound" hint="Define the upper and lower bounds of the noise; see 'What to do?'" endparam int param where default=1 Caption="Region" enum="Betwen" "Above & below" endparam int param what default=0 enum="Set to 0" "Set to bound" hint="What value if it falls in the bound" Caption="What to do" hint="What to do if the noise falls in the bounds." endparam heading caption = "Function modifiers:" endheading func f1 default=ident() endfunc func f2 default=ident() endfunc } Jolinoame { global: $define debug complex d[@points+1] ; lines float k=@k; float teta=@angle; complex pt=0; int i=0 d[0]=pt float angle=0; float length=1; repeat i=i+1; complex le=length*cos(angle)+flip(length*sin(angle)); pt=pt+le; d[i]=pt; length=length*k; angle=i*teta until (i==@points); init: ; the folowing section is taken from Kerry's "Line" - lkm ; I've changed variable "r" to "rr" float rr=0.0 ;distance to segment float x=0.0 float y=0.0 float rr=0.0 t=(0,0) final: float min=1000 ;the distance to the nearest line int ii=0 repeat ii=ii+1 t=(#z-d[ii-1])/(d[ii]-d[ii-1]) x=real(t) y=imag(t) if(x<0.0) rr=sqr(x)+sqr(y) elseif(x>1.0) rr=sqr(x-1.0)+sqr(y) else rr=sqr(y) endif rr=sqrt(rr)*cabs(d[ii]-d[ii-1]) ;this was the last line from Kerry's code if ((rr<@thick) && (rr@thick) #solid=true endif #index=min/@thick default: title = "Jolinome" int param points caption = "Lines" default = 500 min = 0 hint="No of lines." endparam float param angle caption = "Angle" max=360 default = 28 min = 0 endparam float param K caption = "Scaling constant" default = .95 min=0 endparam float param thick caption = "Line thickness" default = .2 min=0 endparam } Curlicue { global: $define debug complex d[@points+1] ; lines float fin=0; float tetan=0; float s=@s ;float pi=3.14159265358979 complex pt=0; int i=0 d[0]=pt repeat i=i+1; tetan =(tetan+2*pi*s) - trunc((tetan+2*pi*s)/(2*pi))*(2*pi); fin = (fin+tetan) - trunc ((fin+tetan)/(2*pi))*(2*pi) pt=pt+1*cos(fin) + flip(1)*sin(fin); d[i]=pt; until (i==@points); init: ; the folowing section is taken from Kerry's "Line" - lkm ; I've changed variable "r" to "rr" float rr=0.0 ;distance to segment float x=0.0 float y=0.0 float rr=0.0 t=(0,0) final: float min=1000 ;the distance to the nearest line int ii=0 repeat ii=ii+1 t=(#z-d[ii-1])/(d[ii]-d[ii-1]) x=real(t) y=imag(t) if(x<0.0) rr=sqr(x)+sqr(y) elseif(x>1.0) rr=sqr(x-1.0)+sqr(y) else rr=sqr(y) endif rr=sqrt(rr)*cabs(d[ii]-d[ii-1]) ;this was the last line from Kerry's code if ((rr<@thick) && (rr@thick) #solid=true endif #index=min/@thick default: title = "Curlicue" int param points caption = "Lines" default = 500 min = 0 hint="No of lines." endparam float param s caption = "S" default = 3.14159265358979 endparam float param thick caption = "Line thickness" default = .2 min=0 endparam } 3DSpheres { ; Here, you can describe the coloring algorithm. This text ; will appear in the browsers as comments. ; For more information about coloring algorithms, look up ; "writing coloring algorithms" in the online help index. global: ;//number of Spheres ;********modify n******** int n=@n; ;*********modify 5******* ;to number of spheres float centerX[@n]; float centerY[@n]; float centerZ[@n]; float r[@n]; float t=0; int i=0 ;********define spheres******** if (@tip==0) while (t<2*Pi) centerX[i]=(4+cos(@nn*t))*cos(@mm*t) centerY[i]=(4+cos(@nn*t))*sin(@mm*t) centerZ[i]=sin(@nn*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==1) while (t<60) centerX[i]=4*sin(t) centerY[i]=4*cos(t) centerZ[i]=t/10 r[i]=@r*@beta^i; t=t+60/(n-1); i=i+1; endwhile endif if (@tip==2) while (t<60) float RR=t/10 centerX[i]=RR*sin(t)+8 centerY[i]=RR*cos(t) centerZ[i]=RR r[i]=@r*@beta^i; t=t+60/(n-1); i=i+1; endwhile endif if (@tip==3) while (t<60) centerX[i]=3*sin(pi*(t/62.8))*sin(t) - 8 centerY[i]=3*sin(pi*(t/62.8))*cos(t) centerZ[i]=t/10 r[i]=@r*@beta^i; t=t+60/(n-1); i=i+1; endwhile endif if (@tip==4) while (t<2*pi) centerX[i]=-2*cos(t)-1/2*cos(5*t)+3*sin(2*t) centerY[i]=-3*cos(2*t)+2*sin(t)-1/2*sin(5*t) centerZ[i]=2*cos(3*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==5) while (t<2*pi) centerX[i]=sin(2*t)*(10.0 + 6*cos(3*t)) centerY[i]=cos(2*t)*(10.0 + 6*cos(3*t)) centerZ[i]=6*sin(3*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==6) while (t<2*pi) centerX[i]=- 33*cos(t) + 43*sin(t) + 214*sin(2*t) - 101*cos(3*t) - 47*sin(3*t) + 11*sin(4*t) centerY[i]=- 57*cos(t) + 99*sin(t) - 54*cos(2*t) - 159*sin(2*t) - 117*cos(3*t) - 5*sin(3*t) - 31*cos(4*t) - 45*sin(4*t) centerZ[i]=34*cos(t) - 21*sin(t) - 100*cos(2*t) - 93*sin(2*t) - 27*cos(3*t) - 16*sin(3*t) + 52*cos(4*t) + 84*sin(4*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==7) while (t<2*pi) centerX[i]=-88*cos(t) + 115*sin(t) - 475*cos(2*t) - 127*sin(2*t) - 87*cos(3*t) + 36*sin(3*t) + 11*cos(4*t) - 19*sin(4*t) centerY[i]=89*cos(t) - 32*sin(t) - 172*cos(2*t) + 294*sin(2*t) + 76*cos(3*t) + 102*sin(3*t) - 61*cos(4*t) + 113*sin(4*t) centerZ[i]=44*cos(t) - 69*sin(t) + 34*cos(2*t) + 223*sin(2*t) + 16*cos(3*t)+ 120*sin(3*t) + 42*cos(4*t) - 125*sin(4*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==8) while (t<2*pi) centerX[i]=12*cos(t) + 20*sin(t) - 163*cos(2*t) + 76*sin(2*t) - 87*cos(3*t) - 15*sin(3*t) - 21*cos(4*t) + 14*sin(4*t)+ 24*cos(5*t) - 50*sin(5*t) centerY[i]=29*cos(t) + 78*sin(t) - 180*cos(2*t) + 58*sin(2*t) + 88*cos(3*t) + 72*sin(3*t) - 14*sin(4*t) centerZ[i]=- 30*cos(t) - 78*sin(t) - 111*cos(2*t) + 37*sin(2*t) - 67*cos(3*t) - 51*sin(3*t) + 31*cos(4*t) + 8*sin(4*t) - 11*cos(5*t) + 65*sin(5*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==9) while (t<2*pi) centerX[i]=- 6*cos(t) - 21*sin(t) - 195*cos(2*t) + 92*sin(2*t) - 64*cos(3*t) - 23*sin(3*t) - 6*cos(4*t) + 13*sin(4*t) + 24*cos(5*t) + 15*sin(5*t) + 41*sin(6*t) centerY[i]=21*cos(t) - 24*sin(t) - 207*cos(2*t) - 72*sin(2*t) + 112*cos(3*t) - 7*sin(3*t) - 13*cos(4*t) - 40*sin(4*t) - 27*cos(5*t) - 3*sin(5*t) - 17*cos(6*t) centerZ[i]= -18*cos(t) - 13*sin(t) + 113*cos(2*t) - 107*sin(2*t) + 86*cos(3*t) - 9*sin(3*t) - 26*cos(4*t) - 7*sin(4*t) + 24*cos(5*t) + 33*sin(5*t) + 21*cos(6*t) + 31*sin(6*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==10) while (t<2*pi) centerX[i]=- 40*cos(t) + 32*sin(t) + 69*cos(2*t) - 12*sin(2*t) + 120*cos(3*t) - 52*sin(3*t) - 56*cos(4*t) + 46*sin(4*t) -17*sin(5*t) + 14*cos(6*t) + 19*sin(6*t) centerY[i]=90*cos(t) + 89*sin(t) - 142*cos(2*t) + 147*sin(2*t) + 74*cos(3*t) + 85*sin(3*t) - 56*sin(4*t) + 23*cos(5*t) + 16*cos(6*t) + 7*sin(6*t) centerZ[i]=52*cos(t) + 64*sin(t) + 53*cos(2*t) + 35*sin(2*t) + 77*cos(3*t) - 87*sin(3*t) + 101*cos(4*t) - 19*sin(4*t) - 5*cos(5*t) + 2*sin(5*t) + 3*cos(6*t) + 9*sin(6*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==11) while (t<2*pi) centerX[i]=32*cos(t) - 51*sin(t) - 104*cos(2*t) - 34*sin(2*t) + 104*cos(3*t) - 91*sin(3*t) centerY[i]=94*cos(t) + 41*sin(t) + 113*cos(2*t) - 68*cos(3*t) - 124*sin(3*t) centerZ[i]=16*cos(t) + 73*sin(t) - 211*cos(2*t) - 39*sin(2*t) - 99*cos(3*t) - 21*sin(3*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==12) while (t<2*pi) centerX[i]=- 22*cos(t) - 128*sin(t) - 44*cos(3*t) - 78*sin(3*t) centerY[i]=- 10*cos(2*t) - 27*sin(2*t) + 38*cos(4*t) + 46*sin(4*t) centerZ[i]=70*cos(3*t)-40*sin(3*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==13) while (t<2*pi) centerX[i]=- 22*cos(t) - 128*sin(t) - 44*cos(3*t) - 78*sin(3*t) centerY[i]=11*cos(t) - 43*cos(3*t) + 34*cos(5*t) - 39*sin(5*t) centerZ[i]=70*cos(3*t) - 40*sin(3*t) + 8*cos(5*t)- 9*sin(5*t) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==14) t=3/2 while (t<18) float rho=@mm+1 centerX[i]=(rho-(@rr+1)*cos(2*pi*t))*cos(2*pi/(@nn-3+t)) centerY[i]=(rho-(@rr+1)*cos(2*pi*t))*sin(2*pi/(@nn-3+t)) centerZ[i]=-(@rr+1)*sin(2*Pi*t) r[i]=@r*@beta^i; t=t+(18-3/2)/(n-1); i=i+1; endwhile endif if (@tip==15) while (t<12.6) centerX[i]=4*sin(t/2) centerY[i]=4*cos(2*t) centerZ[i]=4*sin(2*t) r[i]=@r*@beta^i; t=t+12.6/(n-1); i=i+1; endwhile endif if (@tip==16) while (t<12.6) centerX[i]=2*cos(t/2) centerY[i]=2*sin(t) centerZ[i]=sin(2*t) r[i]=@r*@beta^i; t=t+12.6/(n-1); i=i+1; endwhile endif if (@tip==17) while (t<2*pi) centerX[i]=3*Cos(t) - 2*Sin(t*5) centerY[i]=3*Sin(t) + 2*Cos(t*5) centerZ[i]=Cos(t*6) r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==18) while (t<2*pi) float RR=3+sin(3*t)-cos(12*t) + @rr centerX[i]=RR*cos(t) centerY[i]=RR*sin(t) centerZ[i]=-1 r[i]=@r*@beta^i; t=t+2*pi/(n-1); i=i+1; endwhile endif if (@tip==19) while (t<40*pi) centerX[i]=t*cos(t) centerY[i]=t*sin(t) centerZ[i]=0 r[i]=@r*@beta^i; t=t+40*pi/(n-1); i=i+1; endwhile endif if (@tip==20) while (t<40*pi) float RR=10*cos(0.95*t) + @rr centerX[i]=RR*cos(t) centerY[i]=RR*sin(t) centerZ[i]=0 r[i]=@r*@beta^i; t=t+40*pi/(n-1); i=i+1; endwhile endif if (@tip==21) while (t<18*pi) float RR=t + 2*sin(2*Pi*t) + 4*cos(2*Pi*t) + @rr centerX[i]=RR*cos(t) centerY[i]=RR*sin(t) centerZ[i]=0 r[i]=@r*@beta^i; t=t+18*pi/(n-1); i=i+1; endwhile endif if (@tip==22) while (t<122*pi) float RR=2*(e^sin(t) -2*cos(4*t) + sin(t/12)^5) + @rr centerX[i]=RR*cos(t) centerY[i]=RR*sin(t) centerZ[i]=0 r[i]=@r*@beta^i; t=t+122*pi/(n-1); i=i+1; endwhile endif if (@tip==23) float rad=sqrt(n) float xx=-5 while (xx<=5) float yy=-5 while (yy<=5) float rr=(xx*xx+yy*yy)^0.5 + @rr centerX[i]=xx centerY[i]=-1/(xx*xx+1) + 2/(yy*yy+1) + 0.5*sin(5*rr)/rr centerZ[i]=7+yy r[i]=@r*@beta^i; yy=yy+10/(rad-1); i=i+1; endwhile xx=xx+10/(rad-1) endwhile endif if (@tip==24) float rad=sqrt(n) float xx=-6 while (xx<=6) float yy=-6 while (yy<=6) float rr=(xx*xx+yy*yy)^0.5 + @rr centerX[i]=xx centerY[i]=xx/(xx*xx+1) - yy/(yy*yy+1) + 2*(rr-1)/((rr-1)*(rr-1)+1) centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+12/(rad-1); i=i+1; endwhile xx=xx+12/(rad-1) endwhile endif if (@tip==25) float rad=sqrt(n) float xx=-50 while (xx<=50) float yy=-50 while (yy<=50) float rr=(xx*xx+yy*yy)^0.5+@rr centerX[i]=xx centerY[i]=sin(rr/2*(1 + 0.01 * xx)) / (rr/2)*50 centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+100/(rad-1); i=i+1; endwhile xx=xx+100/(rad-1) endwhile endif if (@tip==26) float rad=sqrt(n) float xx=-40 while (xx<=40) float yy=-40 while (yy<=40) centerX[i]=xx centerY[i]=2*(cos(((xx+0)^2+(yy+0)^2)^(1/2)) + cos(((xx+.913*2*pi)^2+(yy+0)^2)^(1/2)) + cos(((xx-.913*2*pi)^2+(yy+0)^2)^(1/2)) ) centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+80/(rad-1); i=i+1; endwhile xx=xx+80/(rad-1) endwhile endif if (@tip==27) float rad=sqrt(n) float xx=-6 while (xx<=6) float yy=-6 while (yy<=6) centerX[i]=xx centerY[i]=(cos(yy)+sin(xx))*sin(yy+xx) centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+12/(rad-1); i=i+1; endwhile xx=xx+12/(rad-1) endwhile endif if (@tip==28) float rad=sqrt(n) float xx=-2 while (xx<=2) float yy=-2 while (yy<=2) float f1=xx^2+ yy^2 + @rr centerX[i]=xx centerY[i]=cos(f1*12)/(2*(f1*6.28+1)) centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+4/(rad-1); i=i+1; endwhile xx=xx+4/(rad-1) endwhile endif if (@tip==29) float rad=sqrt(n) float xx=-7 while (xx<=7) float yy=-7 while (yy<=7) float mesafe=(xx^2+yy^2)^0.5 +@rr centerX[i]=xx centerY[i]=Cos(mesafe*Pi/2) -2 centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+14/(rad-1); i=i+1; endwhile xx=xx+14/(rad-1) endwhile endif if (@tip==30) float rad=sqrt(n) float xx=-3 while (xx<=3) float yy=-3 while (yy<=3) float rr=((9*(xx^2-yy^2)^2)^(1/3) - (xx^2 + yy^2) )^(1/3)+@rr centerX[i]=2*xx centerY[i]=2*rr centerZ[i]=2*yy r[i]=@r*@beta^i; yy=yy+6/(rad-1); i=i+1; endwhile xx=xx+6/(rad-1) endwhile endif if (@tip==31) float rad=sqrt(n) float xx=-3 while (xx<=3) float yy=-3 while (yy<=3) float rr=xx^2+yy^2+@rr centerX[i]=xx centerY[i]=(8*xx^2*yy^2*#e^(0-rr)) / rr centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+6/(rad-1); i=i+1; endwhile xx=xx+6/(rad-1) endwhile endif if (@tip==32) float rad=sqrt(n) float xx=-8 while (xx<=8) float yy=-8 while (yy<=8) float rr=0 centerX[i]=xx centerY[i]=(64 -@rr - xx^2 - yy^2)^(1/2) centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+16/(rad-1); i=i+1; endwhile xx=xx+16/(rad-1) endwhile endif if (@tip==33) float rad=sqrt(n) float xx=-8 while (xx<=14) float yy=-8 while (yy<=14) centerX[i]=xx centerY[i]=30/(2^10 - @rr + xx^10 + yy^10)^(1/10) centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+22/(rad-1); i=i+1; endwhile xx=xx+22/(rad-1) endwhile endif if (@tip==34) float rad=sqrt(n) float xx=-5 while (xx<=5) float yy=-5 while (yy<=5) float rr=(xx*xx+yy*yy)^0.5 - @rr centerX[i]=xx centerY[i]=1/(1+rr)*(xx*sin((@nn+1)*rr)+yy*cos((@nn+1)*rr)) centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+10/(rad-1); i=i+1; endwhile xx=xx+10/(rad-1) endwhile endif if (@tip==35) float rad=sqrt(n) float xx=-7 while (xx<=7) float yy=-7 while (yy<=7) float rr=(xx*xx+yy*yy)^0.5-@rr centerX[i]=xx centerY[i]=#e^(-rr/4)*sin(3*rr) centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+14/(rad-1); i=i+1; endwhile xx=xx+14/(rad-1) endwhile endif if (@tip==36) float rad=sqrt(n) float xx=-5 while (xx<=5) float yy=-5 while (yy<=5) float rr=0 centerX[i]=xx centerY[i]=12*cos((xx^2+yy^2)/4)/(3+@rr+xx^2+yy^2) centerZ[i]=yy r[i]=@r*@beta^i; yy=yy+10/(rad-1); i=i+1; endwhile xx=xx+10/(rad-1) endwhile endif if (@tip==37) float rad=sqrt(n) float u=0 while (u<=2*pi) float v=-0.3 while (v<=0.3) float rr=0 centerX[i]=5*(cos(u) + v*cos(u/2)*cos(u)) centerY[i]=5*(sin(u) +v*cos(u/2)*sin(u)) centerZ[i]=5*v*sin(u/2) r[i]=@r*@beta^i; v=v+0.6/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==38) float rad=sqrt(n) float u=0 float t=@mm while (u<=2*pi) float v=-0.8*(@rr+1) while (v<=0.8*(@rr+1)) centerX[i]= sin(u)*(2-v*sin(t*u/2)) centerY[i]=cos(u)*(2-v*sin(t*u/2)) centerZ[i]=v*cos(t*u/2) r[i]=@r*@beta^i; v=v+1.6*(@rr+1)/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==39) float rad=sqrt(n) float u=0 while (u<=2*pi) float v=0 while (v<=6.25) centerX[i]=v*cos(u) centerY[i]=v*sin(u) centerZ[i]=12*(@rr+1)*cos((centerX[i]^2+centerY[i]^2)/4)/(3+centerX[i]^2+centerY[i]^2) r[i]=@r*@beta^i; v=v+6.25/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==40) float rad=sqrt(n) float u=0 while (u<=2*pi) float v=-4 while (v<=4) float rr=(@rr+4) centerX[i]=rr*cos(u) - 4 centerY[i]=rr*sin(u) centerZ[i]=v r[i]=@r*@beta^i; v=v+8/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==41) float rad=sqrt(n) float u=0 while (u<=2*pi) float v=-4 while (v<=4) float rr=(@rr+v) centerX[i]=rr*cos(u) centerY[i]=v centerZ[i]=rr*sin(u) r[i]=@r*@beta^i; v=v+8/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==42) float rad=sqrt(n) float t=0 while (t<=2*pi) float b=0 while (b<=2*pi) float rr=6+2*cos(b)*(@rr+1) centerX[i]=rr*cos(t) centerY[i]=rr*sin(t) centerZ[i]=2*sin(b) r[i]=@r*@beta^i; b=b+2*pi/(rad-1); i=i+1; endwhile t=t+2*pi/(rad-1) endwhile endif if (@tip==43) float rad=sqrt(n) float t=-2*pi while (t<=2*pi) float b=0 while (b<=2*pi*(@rr+1)) float rr=b centerX[i]=rr*cos(t) centerY[i]=rr*sin(t) centerZ[i]=t+b r[i]=@r*@beta^i; b=b+2*pi*(@rr+1)/(rad-1); i=i+1; endwhile t=t+4*pi/(rad-1) endwhile endif if (@tip==44) float rad=sqrt(n) float t=0 while (t<=2*pi) float b=-5 while (b<=5) float rr=cos(t*2*(@rr+1)) float theta=t+b*2 centerX[i]=rr*cos(theta) centerY[i]=rr*sin(theta) centerZ[i]=b r[i]=@r*@beta^i; b=b+10/(rad-1); i=i+1; endwhile t=t+2*pi/(rad-1) endwhile endif if (@tip==45) float rad=sqrt(n) float xx=-8 while (xx<=8) float b=0 while (b<=2*pi) float rr=0.05*(1+@rr)*xx^3 - xx + 5 centerX[i]=xx centerY[i]=rr*sin(b) centerZ[i]=rr*cos(b) r[i]=@r*@beta^i; b=b+2*pi/(rad-1); i=i+1; endwhile xx=xx+16/(rad-1) endwhile endif if (@tip==46) float rad=sqrt(n) float s=0 while (s<=2*pi) float t=0 while (t<=2*pi) float rr=5+@rr centerX[i]=cos(s)*sin(2*t)*rr centerY[i]=sin(2*s)*rr centerZ[i]=cos(s)*cos(3*t)*rr r[i]=@r*@beta^i; t=t+2*pi/(rad-1); i=i+1; endwhile s=s+2*pi/(rad-1) endwhile endif if (@tip==47) float rad=sqrt(n) float u=0 while (u<=pi) float v=0 while (v<=pi) float k=4 float L=(2^0.5 - sin(2*u)*sin(3*v)) centerX[i]=k*(2/3)*(cos(u)*cos(2*v)+2^0.5*sin(u)*cos(v))*cos(u) / L centerY[i]=k*(2/3)*(cos(u)*sin(2*v)-2^0.5*sin(u)*sin(v))*cos(u) / L centerZ[i]=k*2^0.5*cos(u)^2 / L r[i]=@r*@beta^i; v=v+pi/(rad-1); i=i+1; endwhile u=u+pi/(rad-1) endwhile endif if (@tip==48) float rad=sqrt(n) float u=-2 while (u<=2) float v=-2 while (v<=2) centerX[i]=u-(u*u*u/3)+u*v*v centerY[i]=v-(v*v*v/3)+u*u*v centerZ[i]=u*u-v*v r[i]=@r*@beta^i; v=v+4/(rad-1); i=i+1; endwhile u=u+4/(rad-1) endwhile endif if (@tip==49) float rad=sqrt(n) float a=2; float k=2+@rr float u=0 while (u<=2*pi) float v=0 while (v<=2*pi) centerX[i]=k*(a+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*cos(u) centerY[i]=k*(a+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*sin(u) centerZ[i]=k*sin(u/2)*sin(v)+cos(u/2)*sin(2*v) r[i]=@r*@beta^i; v=v+2*pi/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==50) float rad=sqrt(n) float a=-2*pi while (a<=2*pi) float b=0 while (b<=2*pi) centerX[i]=2*(2-cos(b)^2)*sin(a) centerZ[i]=2*(2-cos(b)^2)*cos(a) centerY[i]=2*sin(b)+a r[i]=@r*@beta^i; b=b+2*pi/(rad-1); i=i+1; endwhile a=a+4*pi/(rad-1) endwhile endif if (@tip==51) float rad=sqrt(n) float a=0 while (a<=pi) float b=0 while (b<=2*pi) centerX[i]=5*sin(b)*(0.5+sin(a)) centerZ[i]=cos(6*a*(1+@rr))/2 centerY[i]=5*cos(b)*(0.5+sin(a)) r[i]=@r*@beta^i; b=b+2*pi/(rad-1); i=i+1; endwhile a=a+pi/(rad-1) endwhile endif if (@tip==52) float rad=sqrt(n) float u=0 while (u<=pi) float v=0 while (v<=pi) centerX[i]=cos(v)*cos(v)*sin(2*u) / 2 centerY[i]=sin(u)*sin(2*v) / 2 centerZ[i]=cos(u)*sin(2*v) / 2 r[i]=@r*@beta^i; v=v+pi/(rad-1); i=i+1; endwhile u=u+pi/(rad-1) endwhile endif if (@tip==53) float rad=sqrt(n) float u=-pi while (u<=pi) float v=0 while (v<=40) float rr=0 centerX[i]=sin(u) centerY[i]=cos(u+v) centerZ[i]=-abs(v)/2 r[i]=@r*@beta^i; v=v+40/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==54) float rad=sqrt(n) float u=-pi while (u<=pi) float v=-pi while (v<=pi) float rr=0 centerX[i]=sin(u)*sin(v) +cos(20*v)*0.05 centerY[i]=cos(u)*sin(v) +cos(20*u)*0.05 centerZ[i]=cos(v) r[i]=@r*@beta^i; v=v+2*pi/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==55) float rad=sqrt(n) float u=0 while (u<=pi) float v=0 while (v<=2*pi) float rr=v*u centerX[i]=rr*cos(v)*sin(u) centerY[i]=rr*sin(v)*sin(u) centerZ[i]=rr*cos(u) r[i]=@r*@beta^i; v=v+pi/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==56) float rad=sqrt(n) float u=0 while (u<=2*pi) float v=0 while (v<=2*pi) float rr=(@mm+1)/4*(cos((@mm+1)*u+pi/@nn)+sqrt(2)) centerX[i]=@mm*cos(u)+cos(@mm*u)-rr*sin((@mm-1)/2*u)*cos(v) centerY[i]=@mm*sin(u)-sin(@mm*u)-rr*cos((@mm-1)/2*u)*cos(v) centerZ[i]=rr*sin(v) r[i]=@r*@beta^i; v=v+2*pi/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==57) float rad=sqrt(n) float aa=@rr+0.4 float u=-26.4 while (u<=26.4) float v=-68 while (v<=68) float wsqr = 1 - aa * aa; float w=sqrt(wsqr) float denom=aa * (sqr(w * cosh(aa * u)) + sqr(aa * sin(w * v))) centerX[i]=-u + (2 * wsqr * cosh(aa * u) * sinh(aa * u) / denom) centerY[i]=2 * w * cosh(aa * u) * (-(w * cos(v) * cos(w * v)) - (sin(v) * sin(w * v))) / denom centerZ[i]=2 * w * cosh(aa * u) * (-(w * sin(v) * cos(w * v)) + (cos(v) * sin(w * v))) / denom r[i]=@r*@beta^i; v=v+136/(rad-1); i=i+1; endwhile u=u+52.8/(rad-1) endwhile endif if (@tip==58) float rad=sqrt(n) float u=-1.5 while (u<=1.5) float v=-1.5 while (v<=1.5) centerX[i]=u - u * u * u / 3 + u * v * v centerY[i]=v - v * v * v / 3 + v * u * u centerZ[i]=u * u - v * v r[i]=@r*@beta^i; v=v+3/(rad-1); i=i+1; endwhile u=u+3/(rad-1) endwhile endif if (@tip==59) float rad=sqrt(n) float a=4 float b=2 float c=2 float ee=3 float g=12 float u=0 while (u<=2*pi) float v=0 while (v<=2*pi) float w=b*sin(u)+ee float dx=a*cos(u)-a*cos(c*u) float dy=-g*sin(u) float rxy=sqrt(dx^2+dy^2) if (rxy==0) rxy=0.001 endif centerX[i]=a*sin(u)-b*sin(c*u)-(dy*w*cos(v))/(rxy) centerY[i]=g*cos(u)+(dy*w*cos(v))/(rxy) centerZ[i]=w*sin(v) r[i]=@r*@beta^i; v=v+2*pi/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==60) float rad=sqrt(n) float u=-2*(@rr+1)*pi while (u<=2*pi) float v=-pi/2 while (v<=pi) float kk=log(2)/2/pi centerX[i]=e^(kk*u)*(1+cos(v))*cos(u) centerY[i]=e^(kk*u)*(1+cos(v))*sin(u) centerZ[i]=e^(kk*u)*(2+sin(v)) r[i]=@r*@beta^i; v=v+3/2*pi/(rad-1); i=i+1; endwhile u=u+2*(@rr+1+1)*pi/(rad-1) endwhile endif if (@tip==61) float rad=sqrt(n) float a=0.3*(@mm-1) float b=0.5*(@nn-2) float u=0 while (u<=2*pi) float v=-3*(@rr+1) while (v<=3*(@rr+1)) float rr=0 centerX[i]=e^(b*v)*cos(v)+e^(a*v)*cos(u)*cos(v) centerY[i]=e^(b*v)*sin(v)+e^(a*v)*cos(u)*sin(v) centerZ[i]=e^(a*v)*sin(u) r[i]=@r*@beta^i; v=v+6*(@rr+1)/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==62) float rad=sqrt(n) float AA=@mm-2 float BB=@nn-2 float CC=@rr+1 float u=0 while (u<=2*pi) float v=0 while (v<=2*pi) float rr=0 centerX[i]=(AA*cos(u)*cos(v))^3 centerY[i]=(BB*sin(u)*cos(v))^3 centerZ[i]=(CC*sin(v))^3 r[i]=@r*@beta^i; v=v+2*pi/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==63) float aa=@rr t=-10*@nn while (t<10*@nn) centerX[i]=cos(t)*cos(atan (aa*t)) centerY[i]= -sin(atan (aa*t)) centerZ[i]=sin(t)*cos(atan (aa*t)) r[i]=@r*@beta^i; t=t+20*@nn/(n-1); i=i+1; endwhile endif if (@tip==64) float rad=sqrt(n) float a=@nn-1; float b=@mm; float u=-pi while (u<=pi) float v=-pi while (v<=pi) centerX[i]=a*sin(b*u) / (a + cos(v)) centerY[i]=a*(sin(u) + a*sin(a*u)) / (a + cos(v + a*pi / b)) centerZ[i]=(cos(u) - a*cos(a*u))*(a + cos(v))*(a + cos(v + a*pi / b)) / 4 r[i]=@r*@beta^i; v=v+2*pi/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif if (@tip==65) float rad=sqrt(n) float a=0.655866 *@mm/3 float b=0.754878 *@nn/3 float c=0.868837 *(@rr+1) float u=0 while (u<=2*pi) float v=0 while (v<=2*pi) float rr=0 centerX[i]=a*cos(1.03002 + u)*(2 + cos(v)) centerY[i]=b*cos(1.40772 - u)*(2 + c*cos(2.43773 + v)) centerZ[i]=c*cos(2.43773 + u)*(2 + 0.495098*cos(0.377696 - v)) r[i]=@r*@beta^i; v=v+2*pi/(rad-1); i=i+1; endwhile u=u+2*pi/(rad-1) endwhile endif ;****************** int i=0; while (i=0) centerX[i]=centerX[i-1] centerY[i]=centerY[i-1] centerZ[i]=centerZ[i-1] i=i-1; endwhile centerX[0]=centerX[1]-(centerX[2]-centerX[1]); centerY[0]=centerY[1]-(centerY[2]-centerY[1]); centerZ[0]=centerZ[1]-(centerZ[2]-centerZ[1]); nr=nr+1; endwhile ;tensionning int nr=0; float distmax=sqr(centerX[1]-centerX[0])+sqr(centerY[1]-centerY[0])+sqr(centerZ[1]-centerZ[0]) distmax=sqrt(distmax) while (nr<@tens) int i=n-1 while (i>=0) centerX[i]=centerX[i]-@procTens*(centerX[i]-centerX[0]) centerZ[i]=centerZ[i]-@procTens*(centerZ[i]-centerZ[0]) centerY[i]=centerY[i]+i/n*distmax i=i-1; endwhile nr=nr+1; endwhile init: float x=real(#pixel); float y=imag(#pixel); int p=-1;//which sphere is closest; float zmin=10000;//how far is the closest sphere float dcmin=0.1; int m=0; while (m0) endparam heading caption = "Potation Parameters" ;expanded = true endheading float param rotx default=0; caption="X Rotation" endparam float param roty default=0; caption="Y Rotation" endparam float param zorigin default=3; caption="Z Origin" endparam heading caption = "Sphere Parameters" ;expanded = true endheading float param R default=.5; caption="Radius" endparam int param numcol default=1; caption="No.Colors" endparam float param inmcol default=1; caption="Consecutive Spheres" Hint="Number of Consecutive Spheres to be colored with the same gradient" endparam float param beta default=1; caption="Radius Index" Hint="Set it very close to 1; it is exponensial!" endparam } 3D-Sphere { global: int i; int j; int temp; int p[257]; float g[257]; float max; int seed=@seed; i=0 repeat i=i+1 p[i]=i seed = random(seed) g[i]=seed/#randomrange until i==256 i=-1 repeat i=i+1 seed = random(seed) j= abs(seed) % 255 +1; temp=p[i]; p[i]=p[j]; p[j]=temp; until i==255 max=0; i=0 repeat i=i+1 max= max + real(@f1(@persistenta^(i-1)*@amplitudine)); until i==@octave max=real(@f2(max)) loop: int k; float rx = real(#pixel); float ry = imag(#pixel); float rz=(1-rx^2-ry^2)^(1/2); float zinitial=rz; float rx=rx*@scale; float ry=ry*@scale; float rz=rz*@scale; float pcte[9]; int x; int y; int z; int xx; int yy; int zz; float f; float ff; float noise=0; float kk k=0; repeat k=k+1 rx=rx*2; ry=ry*2; rz=rz*2; x=floor(rx); y=floor(ry); z=floor(rz); xx=x+1; yy=y+1; zz=z+1; pcte[1]=g[abs(x+p[abs(y+p[abs(z % 255) + 1])% 255 + 1])% 255 + 1]; pcte[2]=g[abs(x+p[abs(y+p[abs(zz % 255) + 1])% 255 + 1])% 255 + 1]; pcte[3]=g[abs(x+p[abs(yy+p[abs(z % 255) + 1])% 255 + 1])% 255 + 1]; pcte[4]=g[abs(x+p[abs(yy+p[abs(zz % 255) + 1])% 255 + 1])% 255 + 1]; pcte[5]=g[abs(xx+p[abs(y+p[abs(z % 255) + 1])% 255 + 1])% 255 + 1]; pcte[6]=g[abs(xx+p[abs(y+p[abs(zz % 255) + 1])% 255 + 1])% 255 + 1]; pcte[7]=g[abs(xx+p[abs(yy+p[abs(z % 255) + 1])% 255 + 1])% 255 + 1]; pcte[8]=g[abs(xx+p[abs(yy+p[abs(zz % 255) + 1])% 255 + 1])% 255 + 1]; if @interpolare == 1 ;interpolare z f=(rz-z)*pi; ff=(1-cos(f))*0.5; pcte[1]=(1-ff)*pcte[1]+ff*pcte[2]; pcte[2]=(1-ff)*pcte[3]+ff*pcte[4]; pcte[3]=(1-ff)*pcte[5]+ff*pcte[6]; pcte[4]=(1-ff)*pcte[7]+ff*pcte[8]; ;interpolare y f=(ry-y)*pi; ff=(1-cos(f))*0.5; pcte[1]=(1-ff)*pcte[1]+ff*pcte[2]; pcte[2]=(1-ff)*pcte[3]+ff*pcte[4]; ;interpolare x f=(rx-x)*pi; ff=(1-cos(f))*0.5; pcte[1]=(1-ff)*pcte[1]+ff*pcte[2]; endif; if @interpolare == 0 ;interpolare z f=rz-z; pcte[1]=(1-f)*pcte[1]+f*pcte[2]; pcte[2]=(1-f)*pcte[3]+f*pcte[4]; pcte[3]=(1-f)*pcte[5]+f*pcte[6]; pcte[4]=(1-f)*pcte[7]+f*pcte[8]; ;interpolare y f=ry-y; pcte[1]=(1-f)*pcte[1]+(f)*pcte[2]; pcte[2]=(1-f)*pcte[3]+(f)*pcte[4]; ;interpolare x f=rx-x; pcte[1]=(1-f)*pcte[1]+f*pcte[2]; endif; if @interpolare == 2 f=zz-rz; ff=1-f; ;interpolare z pcte[1]=(3*f*f-2*f*f*f)*pcte[1]+(3*ff*ff-2*ff*ff*ff)*pcte[2]; pcte[2]=(3*f*f-2*f*f*f)*pcte[3]+(3*ff*ff-2*ff*ff*ff)*pcte[4]; pcte[3]=(3*f*f-2*f*f*f)*pcte[5]+(3*ff*ff-2*ff*ff*ff)*pcte[6]; pcte[4]=(3*f*f-2*f*f*f)*pcte[7]+(3*ff*ff-2*ff*ff*ff)*pcte[8]; f=yy-ry; ff=1-f; ;interpolare y pcte[1]=(3*f*f-2*f*f*f)*pcte[1]+(3*ff*ff-2*ff*ff*ff)*pcte[2]; pcte[2]=(3*f*f-2*f*f*f)*pcte[3]+(3*ff*ff-2*ff*ff*ff)*pcte[4]; f=xx-rx; ff=1-f; ;interpolare ; pcte[1]=(3*f*f-2*f*f*f)*pcte[1]+(3*ff*ff-2*ff*ff*ff)*pcte[2]; endif; if @alterare == 0 noise = noise+real(@f1(pcte[1]*@amplitudine*@persistenta^(k-1))); endif if @alterare == 1 noise = noise+real(@f1(abs(pcte[1]*@amplitudine*@persistenta^(k-1)))); endif if @alterare == 2 noise = noise+real(@f1(abs(pcte[1]*@amplitudine*@persistenta^(k-1)))); endif until k==@octave; if @alterare==2 noise=real(@f2(sin(real(#pixel)+noise))); kk=noise/2+0.5 else kk=real(@f2(noise))/(max*2)+(max/2); endif final: float lumz=-cos(@az/180*pi); float lumx=cos((@az+90)/180*pi); float lumy=sin(@alt/180*pi); float lumdist=sqrt((lumx-real(#pixel))^2+(lumz-zinitial)^2+(lumy-imag(#pixel))^2) #color=gradient(kk) if lumdist<2*@fong #color=blend(gradient(kk), @white, (2*@fong-lumdist)/@fong); endif if lumdist<@fong #color=blend(gradient(kk), @white, 1); endif if lumdist>1 #color=mergemultiply(gradient(kk), blend(@white,@black, (lumdist-1)/1)); endif if (real(#pixel))^2+(imag(#pixel))^2>1 #solid=true; endif; default: title = "3D - Sphere" int param octave caption = "Octaves" default = 5 min = 1 endparam float param persistenta caption = "Persistence" default = .6 endparam float param amplitudine caption = "amplitude" default = .1 min = 0 endparam int param interpolare caption = "Interpolation." enum = "Linear" "Cosine" "Cubic" default = 2 endparam float param scale caption = "Scale" default = 1 min = 0.0000000001 endparam int param alterare caption = "Alter by" enum = "None" "Turbulence" "Sinus" default = 1 endparam int param seed caption = "Seed" default = 135792460 hint = "The seed used for random numbers generating." endparam heading caption = "Light:" endheading float param az caption = "Azimuth" default = 130 min=0 max=360 endparam float param alt caption = "Altitude" default = 33 min=-90 max=90 endparam float param fong caption = "Fong size" default = 0.15 min=0 endparam color param white caption = "Fong" default = rgba(1,1,1,1) endparam color param black caption = "Shadow" default = rgba(0,0,0,1) endparam heading caption = "Function modifiers:" endheading func f1 default=ident() endfunc func f2 default=ident() endfunc } ExportFrame { init: int l=256 if (!@Simple) l=l*16 endif float height=@Width/@AspectRatio loop: float x=real(#pixel-@Center) float y=imag(#pixel-@Center) final: if (abs(x)>@Width/2) || (abs(y)>height/2) #solid=true else x=x+@Width/2 y=height-(y+height/2) float xx=x/@Width*l float yy=y/height*l ;x = first 4 bits of Green "+" the bits from Red ;y = last 4 bits of Green "+" the bits from Blue int GS=floor(xx/256) int R=floor(xx-GS*256) int GI=floor(yy/256) int B=floor(yy-GI*256) int G=floor(GS*16+GI) if (@Simple) G=255 endif #color=rgb(R/255,G/255,B/255) endif default: title = "ExportFrame" param Center default=(0,0) endparam float param Width default=1 endparam float param AspectRatio default=1 endparam bool param Simple default=false endparam } Maze { global: ;printing the needed Cache if (@ComputeCache) $define DEBUG if (@Type==0) print("Cache Size=",2*(@x+1)*(@y+1)+1) endif endif int nlinii=0 ;generating the cache bool Cache[@Cache] int i=0 ;clearing cache while (i<@Cache) Cache[i]=false i=i+1 endwhile ;setting the frame i=0 int offset1=0 int offset2=@y*(@x+1) ;horizontal while (i<@x) Cache[offset1+i]=true Cache[offset2+i]=true i=i+1 endwhile offset1=(@x+1)*(@y+1) offset2=offset1+(@y+1)*@x i=0 ;vertical while (i<@y) Cache[offset1+i]=true Cache[offset2+i]=true i=i+1 endwhile ;tring to make the maze i=0 int randd=@ran while (i<@Loops) ;pick a random line randd=random(randd) int ran=abs(randd)%(@Cache-1) ;test to see if it isn't already in the maze if (!Cache[ran]) ;test to see whether the line conects to another one ;but not with a third bool b1=false bool b2=false int off=(@x+1)*(@y+1) ;horizontal line if (ran0 && Cache[yy*(@x+1)+(xx-1)] ) b1=true; endif if(xx<@x && Cache[yy*(@x+1)+(xx+1)] ) b2=true; endif if(yy>0 && Cache[off+xx*(@y+1)+(yy-1)] ) b1=true; endif if(yy<@y && Cache[off+xx*(@y+1)+(yy)] ) b1=true; endif if (xx<@x) if(yy>0 && Cache[off+(xx+1)*(@y+1)+(yy-1)] ) b2=true; endif if(yy<@y && Cache[off+(xx+1)*(@y+1)+(yy)] ) b2=true; endif endif endif ;vertical line if (ran>off) int yy=(ran-off)%(@y+1) int xx=round((ran-off-yy)/(@y+1)) if(xx>0 && Cache[yy*(@x+1)+(xx-1)] ) b1=true; endif if(xx<@x && Cache[yy*(@x+1)+(xx)] ) b1=true; endif if(yy>0 && Cache[off+xx*(@y+1)+(yy-1)] ) b1=true; endif if(yy<@y && Cache[off+xx*(@y+1)+(yy+1)] ) b2=true; endif if(yy<@y) if(xx>0 && Cache[(yy+1)*(@x+1)+(xx-1)] ) b2=true; endif if(xx<@x && Cache[(yy+1)*(@x+1)+(xx)] ) b2=true; endif endif endif if ( (b1||b2) && !(b1&&b2) ) Cache[ran]=true endif endif i=i+1 endwhile ;clearing extra lines i=0 ;horizontal while (i<@y+1) Cache[(i+1)*(@x+1)-1]=false i=i+1 endwhile i=@Cache ;vertical i=0 offset1=(@x+1)*(@y+1) while (i<@x+1) Cache[offset1+(i+1)*(@y+1)-1]=false; i=i+1 endwhile ;generating the lines we need complex ds[@Cache] complex df[@Cache] i=0 int offset=(@x+1)*(@y+1) while (i<@Cache) if (Cache[i]==true) if (i1.0) rr=sqr(x-1.0)+sqr(y) else rr=sqr(y) endif rr=sqrt(rr)*cabs(ds[ii]-df[ii]) ;this was the last line from Kerry's code if ((rr<@thick) && (rr@thick) #solid=true endif #index=min/@thick default: title = "Maze" int param Version default=1 visible=false endparam bool param ComputeCache default = false hint = "Use this so that the formula will tell you the size of the cache it needs." endparam param Type enum = "Rectangular" default = 0 endparam int param Cache default=2000 endparam heading caption = "Grid" endheading int param x default=10 min=2 caption="Grid Width" endparam int param y default=10 min=2 caption="Grid Height" endparam float param thick default=0.01 caption="Thickness" endparam heading caption = "Maze Generation" endheading int param Loops default =10000 hint = "Set this as high as you can. Be carefull though the computing time will increase." endparam int param ran default =12345 hint = "Seed" endparam } RoundMaze { global: ;printing the needed Cache if (@ComputeCache) $define DEBUG int row=1 float length=2*#pi; int total=0; int number=@n; while (row<@r) total=total+number if (length*2 <= 2*#pi*(row+1)) length=2*#pi*(row+1) number=number*2 endif total=total+number row=row+1; endwhile print("Cache Size=",2*total) endif ;generating the cache bool exista[@Cache] bool linie[@Cache] complex start[@Cache] complex stop[@Cache] float alfaStart[@Cache] float alfaStop[@Cache] int i=0 ;clearing cache while (i<@Cache) exista[i]=false linie[i]=false start[i]=0 stop[i]=0 i=i+1 endwhile ;date despre labirint int row=1 float length=2*#pi; int total=0; int number=@n; while (row<@r) i=0 while (i=total-number) exista[i]=true i=i-1 endwhile ; create inner circle if (@c2) exista[@n]=false number=@n; length=2*#pi i=@n if (length*2 <= 2*#pi*(2)) length=2*#pi*(2) number=number*2 endif while (i1.0) rr=sqr(x-1.0)+sqr(y) else rr=sqr(y) endif rr=sqrt(rr)*cabs(start[ii]-stop[ii]) ;this was the last line from Kerry's code endif if (!linie[ii]) float rr=1000; float alfaa=atan2(#z) if (alfaa<0) alfaa=alfaa+2*#pi endif if (alfaStart[ii]<=alfaa && alfaStop[ii]>=alfaa) rr=abs( sqrt(|#z|) - sqrt(|start[ii]|) ) else float d1=sqrt(|#z-start[ii]|) float d2=sqrt(|#z-stop[ii]|) if (d1@thick) #solid=true endif #index=min/@thick default: title = "Round Maze" int param Version default=1 visible=false endparam bool param ComputeCache default = false hint = "Use this so that the formula will tell you the size of the cache it needs." endparam int param Cache default=2000 endparam heading caption = "Grid" endheading int param r default=10 min=1 caption="Circle Radius" endparam int param n default=8 min=4 caption="Sectors" endparam float param thick default=0.01 caption="Thickness" endparam heading caption = "Maze Generation" endheading bool param c1 default=false caption="Center Rays" endparam bool param c2 default=true caption="Center Circle" endparam bool param prog default=true caption="Progresive generation" endparam int param Loops default =10000 hint = "Set this as high as you can. Be carefull though the computing time will increase." endparam int param ran default =12345 hint = "Seed" caption="Random Seed" endparam }