Sub DoeBristorBrot() Dim nx, ny, nz As Long Dim ix, iy, iz As Long Dim gstop, gtel, telmax As Long Dim xx, yy, zz As Double Dim xx0, yy0, zz0 As Double Dim xx1, yy1, zz1 As Double Dim xx2, yy2, zz2 As Double Dim xx3, yy3, zz3 As Double Dim xx4, yy4, zz4 As Double Dim xx5, yy5, zz5 As Double Dim xx6, yy6, zz6 As Double Dim xx7, yy7, zz7 As Double Dim xx8, yy8, zz8 As Double Dim a As Double Dim voxels() As Integer nx = 250 ny = 250 nz = 250 xmin = -2 xmax = 0.5 ymin = -1.25 ymax = 1.25 'xmin = -1.75 'xmax = 1.75 'ymin = -1.75 'ymax = 1.75 zmin = ymin zmax = ymax a = 2 telmax = 100 ReDim voxels(nx, ny, nz) Form1.ScaleMode = 1 Form1.Left = 50 'GwFract.Width = Screen.Width - 50 - 50 Form1.Top = 50 Form1.Height = Screen.Height - 50 - 450 Form1.Width = Screen.Height Form1.ScaleMode = 3 Form1.Picture1.ScaleMode = 3 Form1.Picture1.Left = 0 Form1.Picture1.Width = Form1.ScaleWidth Form1.Picture1.Top = 50 Form1.Picture1.Height = Form1.ScaleHeight Form1.AutoRedraw = False Form1.Picture1.AutoRedraw = False Form1.Cls Form1.Picture1.Cls For iz = 0 To nz Form1.Picture1.Cls For iy = 0 To ny For ix = 0 To nx xx = xmin + (xmax - xmin) * ix / nx yy = ymin + (ymax - ymin) * iy / ny zz = zmin + (zmax - zmin) * iz / nz gstop = 0 gtel = 0 xx0 = xx yy0 = yy zz0 = zz ' xx0 = -0.51 ' yy0 = 0.52 ' xx0 = -0.8 ' yy0 = 0.156 ' zz0 = 0 Do xxx = xx * xx - yy * yy - zz * zz + xx0 yyy = yy * (2 * xx + a * zz) + yy0 ' zz = zz * (2 * xx - yy) + zz0 zz = zz * (2 * xx - a * yy) + zz0 xx = xxx yy = yyy If (xx * xx + yy * yy + zz * zz) > 8 Then gstop = 1 gtel = gtel + 1 If gtel > telmax Then gstop = 1 Loop Until gstop = 1 If gtel > telmax Then voxels(ix, iy, iz) = 1 Form1.Picture1.PSet (ix, iy) Else voxels(ix, iy, iz) = 0 End If Next ix Next iy Form1.Text1.Text = iz DoEvents Next iz For iz = 1 To nz - 1 For iy = 1 To ny - 1 For ix = 1 To nx - 1 If voxels(ix, iy, iz) = 1 Then buren = 0 If voxels(ix - 1, iy, iz) > 0 Then buren = buren + 1 If voxels(ix + 1, iy, iz) > 0 Then buren = buren + 1 If voxels(ix, iy - 1, iz) > 0 Then buren = buren + 1 If voxels(ix, iy + 1, iz) > 0 Then buren = buren + 1 If voxels(ix, iy, iz - 1) > 0 Then buren = buren + 1 If voxels(ix, iy, iz + 1) > 0 Then buren = buren + 1 If buren = 6 Then voxels(ix, iy, iz) = 2 End If Next ix Next iy Form1.Text1.Text = iz DoEvents Next iz kleur1$ = " pigment { rgb <1,1,0> *1 } finish {phong 0.1 ambient 0.04 diffuse .05 }" kleur2$ = " pigment { rgb <1,0,0> *1 } finish {phong 0.1 ambient 0.04 diffuse .05 }" kleur3$ = " pigment { rgb <0,0.6,0> *1 } finish {phong 0.1 ambient 0.04 diffuse .05 }" kleur4$ = " pigment { rgb <0.8,0.8,0.8> *0 } finish {phong 0.1 ambient 0.04 diffuse .05 }" 'r_resist$ = "0.01 }" r_resist$ = Format(0.05 / nx, "0.0000") & "}" A2$ = " finish {phong 0.01 ambient 0.2 diffuse .4 specular 0.5 crand 0.05}" mijnpad = "C:\Users\westy\OneDrive\Documents" Open mijnpad & "\" & "BristorBrot" & ".inc" For Output As #2 For iz = 0 To nz For iy = 0 To ny For ix = 0 To nx If voxels(ix, iy, iz) = 1 Then xx1 = (ix - 0.5) / nx - 0.5 yy1 = (iy - 0.5) / ny - 0.5 zz1 = (iz - 0.5) / nz - 0.5 xx2 = (ix + 0.5) / nx - 0.5 yy2 = (iy - 0.5) / ny - 0.5 zz2 = (iz - 0.5) / nz - 0.5 xx3 = (ix - 0.5) / nx - 0.5 yy3 = (iy + 0.5) / ny - 0.5 zz3 = (iz - 0.5) / nz - 0.5 xx4 = (ix + 0.5) / nx - 0.5 yy4 = (iy + 0.5) / ny - 0.5 zz4 = (iz - 0.5) / nz - 0.5 xx5 = (ix - 0.5) / nx - 0.5 yy5 = (iy - 0.5) / ny - 0.5 zz5 = (iz + 0.5) / nz - 0.5 xx6 = (ix + 0.5) / nx - 0.5 yy6 = (iy - 0.5) / ny - 0.5 zz6 = (iz + 0.5) / nz - 0.5 xx7 = (ix - 0.5) / nx - 0.5 yy7 = (iy + 0.5) / ny - 0.5 zz7 = (iz + 0.5) / nz - 0.5 xx8 = (ix + 0.5) / nx - 0.5 yy8 = (iy + 0.5) / ny - 0.5 zz8 = (iz + 0.5) / nz - 0.5 '****z_decr*** Print #2, "triangle {< "; Print #2, Format(xx4, "0.000000"); ", "; Print #2, Format(zz4, "0.000000"); ", "; Print #2, Format(yy4, "0.000000"); ">, <"; Print #2, Format(xx1, "0.000000"); ", "; Print #2, Format(zz1, "0.000000"); ", "; Print #2, Format(yy1, "0.000000"); ">, <"; Print #2, Format(xx2, "0.000000"); ", "; Print #2, Format(zz2, "0.000000"); ", "; Print #2, Format(yy2, "0.000000"); ">" Print #2, kleur1$ Print #2, " }" Print #2, "triangle {< "; Print #2, Format(xx1, "0.000000"); ", "; Print #2, Format(zz1, "0.000000"); ", "; Print #2, Format(yy2, "0.000000"); ">, <"; Print #2, Format(xx4, "0.000000"); ", "; Print #2, Format(zz4, "0.000000"); ", "; Print #2, Format(yy4, "0.000000"); ">, <"; Print #2, Format(xx3, "0.000000"); ", "; Print #2, Format(zz3, "0.000000"); ", "; Print #2, Format(yy3, "0.000000"); ">" Print #2, kleur1$ Print #2, " }" '****z_incr*** Print #2, "triangle {< "; Print #2, Format(xx8, "0.000000"); ", "; Print #2, Format(zz8, "0.000000"); ", "; Print #2, Format(yy8, "0.000000"); ">, <"; Print #2, Format(xx5, "0.000000"); ", "; Print #2, Format(zz5, "0.000000"); ", "; Print #2, Format(yy5, "0.000000"); ">, <"; Print #2, Format(xx6, "0.000000"); ", "; Print #2, Format(zz6, "0.000000"); ", "; Print #2, Format(yy6, "0.000000"); ">" Print #2, kleur1$ Print #2, " }" Print #2, "triangle {< "; Print #2, Format(xx5, "0.000000"); ", "; Print #2, Format(zz5, "0.000000"); ", "; Print #2, Format(yy5, "0.000000"); ">, <"; Print #2, Format(xx8, "0.000000"); ", "; Print #2, Format(zz8, "0.000000"); ", "; Print #2, Format(yy8, "0.000000"); ">, <"; Print #2, Format(xx7, "0.000000"); ", "; Print #2, Format(zz7, "0.000000"); ", "; Print #2, Format(yy7, "0.000000"); ">" Print #2, kleur1$ Print #2, " }" '****y_decr*** Print #2, "triangle {< "; Print #2, Format(xx2, "0.000000"); ", "; Print #2, Format(zz2, "0.000000"); ", "; Print #2, Format(yy2, "0.000000"); ">, <"; Print #2, Format(xx5, "0.000000"); ", "; Print #2, Format(zz5, "0.000000"); ", "; Print #2, Format(yy5, "0.000000"); ">, <"; Print #2, Format(xx6, "0.000000"); ", "; Print #2, Format(zz6, "0.000000"); ", "; Print #2, Format(yy6, "0.000000"); ">" Print #2, kleur2$ Print #2, " }" Print #2, "triangle {< "; Print #2, Format(xx5, "0.000000"); ", "; Print #2, Format(zz5, "0.000000"); ", "; Print #2, Format(yy5, "0.000000"); ">, <"; Print #2, Format(xx2, "0.000000"); ", "; Print #2, Format(zz2, "0.000000"); ", "; Print #2, Format(yy2, "0.000000"); ">, <"; Print #2, Format(xx1, "0.000000"); ", "; Print #2, Format(zz1, "0.000000"); ", "; Print #2, Format(yy1, "0.000000"); ">" Print #2, kleur2$ Print #2, " }" '****y_incr*** Print #2, "triangle {< "; Print #2, Format(xx8, "0.000000"); ", "; Print #2, Format(zz8, "0.000000"); ", "; Print #2, Format(yy8, "0.000000"); ">, <"; Print #2, Format(xx3, "0.000000"); ", "; Print #2, Format(zz3, "0.000000"); ", "; Print #2, Format(yy3, "0.000000"); ">, <"; Print #2, Format(xx4, "0.000000"); ", "; Print #2, Format(zz4, "0.000000"); ", "; Print #2, Format(yy4, "0.000000"); ">" Print #2, kleur2$ Print #2, " }" Print #2, "triangle {< "; Print #2, Format(xx3, "0.000000"); ", "; Print #2, Format(zz3, "0.000000"); ", "; Print #2, Format(yy3, "0.000000"); ">, <"; Print #2, Format(xx8, "0.000000"); ", "; Print #2, Format(zz8, "0.000000"); ", "; Print #2, Format(yy8, "0.000000"); ">, <"; Print #2, Format(xx7, "0.000000"); ", "; Print #2, Format(zz7, "0.000000"); ", "; Print #2, Format(yy7, "0.000000"); ">" Print #2, kleur2$ Print #2, " }" '****x_decr*** Print #2, "triangle {< "; Print #2, Format(xx3, "0.000000"); ", "; Print #2, Format(zz3, "0.000000"); ", "; Print #2, Format(yy3, "0.000000"); ">, <"; Print #2, Format(xx5, "0.000000"); ", "; Print #2, Format(zz5, "0.000000"); ", "; Print #2, Format(yy5, "0.000000"); ">, <"; Print #2, Format(xx1, "0.000000"); ", "; Print #2, Format(zz1, "0.000000"); ", "; Print #2, Format(yy1, "0.000000"); ">" Print #2, kleur3$ Print #2, " }" Print #2, "triangle {< "; Print #2, Format(xx5, "0.000000"); ", "; Print #2, Format(zz5, "0.000000"); ", "; Print #2, Format(yy5, "0.000000"); ">, <"; Print #2, Format(xx3, "0.000000"); ", "; Print #2, Format(zz3, "0.000000"); ", "; Print #2, Format(yy3, "0.000000"); ">, <"; Print #2, Format(xx7, "0.000000"); ", "; Print #2, Format(zz7, "0.000000"); ", "; Print #2, Format(yy7, "0.000000"); ">" Print #2, kleur3$ Print #2, " }" '****x_incr*** Print #2, "triangle {< "; Print #2, Format(xx2, "0.000000"); ", "; Print #2, Format(zz2, "0.000000"); ", "; Print #2, Format(yy2, "0.000000"); ">, <"; Print #2, Format(xx8, "0.000000"); ", "; Print #2, Format(zz8, "0.000000"); ", "; Print #2, Format(yy8, "0.000000"); ">, <"; Print #2, Format(xx4, "0.000000"); ", "; Print #2, Format(zz4, "0.000000"); ", "; Print #2, Format(yy4, "0.000000"); ">" Print #2, kleur3$ Print #2, " }" Print #2, "triangle {< "; Print #2, Format(xx8, "0.000000"); ", "; Print #2, Format(zz8, "0.000000"); ", "; Print #2, Format(yy8, "0.000000"); ">, <"; Print #2, Format(xx2, "0.000000"); ", "; Print #2, Format(zz2, "0.000000"); ", "; Print #2, Format(yy2, "0.000000"); ">, <"; Print #2, Format(xx6, "0.000000"); ", "; Print #2, Format(zz6, "0.000000"); ", "; Print #2, Format(yy6, "0.000000"); ">" Print #2, kleur3$ Print #2, " }" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx1, "0.0000"); ", "; Print #2, Format(zz1, "0.0000"); ", "; Print #2, Format(yy1, "0.0000"); ">, < "; Print #2, Format(xx2, "0.0000"); ", "; Print #2, Format(zz2, "0.0000"); ", "; Print #2, Format(yy2, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx2, "0.0000"); ", "; Print #2, Format(zz2, "0.0000"); ", "; Print #2, Format(yy2, "0.0000"); ">, < "; Print #2, Format(xx4, "0.0000"); ", "; Print #2, Format(zz4, "0.0000"); ", "; Print #2, Format(yy4, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx4, "0.0000"); ", "; Print #2, Format(zz4, "0.0000"); ", "; Print #2, Format(yy4, "0.0000"); ">, < "; Print #2, Format(xx3, "0.0000"); ", "; Print #2, Format(zz3, "0.0000"); ", "; Print #2, Format(yy3, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx3, "0.0000"); ", "; Print #2, Format(zz3, "0.0000"); ", "; Print #2, Format(yy3, "0.0000"); ">, < "; Print #2, Format(xx1, "0.0000"); ", "; Print #2, Format(zz1, "0.0000"); ", "; Print #2, Format(yy1, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx5, "0.0000"); ", "; Print #2, Format(zz5, "0.0000"); ", "; Print #2, Format(yy5, "0.0000"); ">, < "; Print #2, Format(xx6, "0.0000"); ", "; Print #2, Format(zz6, "0.0000"); ", "; Print #2, Format(yy6, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx6, "0.0000"); ", "; Print #2, Format(zz6, "0.0000"); ", "; Print #2, Format(yy6, "0.0000"); ">, < "; Print #2, Format(xx8, "0.0000"); ", "; Print #2, Format(zz8, "0.0000"); ", "; Print #2, Format(yy8, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx8, "0.0000"); ", "; Print #2, Format(zz8, "0.0000"); ", "; Print #2, Format(yy8, "0.0000"); ">, < "; Print #2, Format(xx7, "0.0000"); ", "; Print #2, Format(zz7, "0.0000"); ", "; Print #2, Format(yy7, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx7, "0.0000"); ", "; Print #2, Format(zz7, "0.0000"); ", "; Print #2, Format(yy7, "0.0000"); ">, < "; Print #2, Format(xx5, "0.0000"); ", "; Print #2, Format(zz5, "0.0000"); ", "; Print #2, Format(yy5, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx1, "0.0000"); ", "; Print #2, Format(zz1, "0.0000"); ", "; Print #2, Format(yy1, "0.0000"); ">, < "; Print #2, Format(xx5, "0.0000"); ", "; Print #2, Format(zz5, "0.0000"); ", "; Print #2, Format(yy5, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx2, "0.0000"); ", "; Print #2, Format(zz2, "0.0000"); ", "; Print #2, Format(yy2, "0.0000"); ">, < "; Print #2, Format(xx6, "0.0000"); ", "; Print #2, Format(zz6, "0.0000"); ", "; Print #2, Format(yy6, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx3, "0.0000"); ", "; Print #2, Format(zz3, "0.0000"); ", "; Print #2, Format(yy3, "0.0000"); ">, < "; Print #2, Format(xx7, "0.0000"); ", "; Print #2, Format(zz7, "0.0000"); ", "; Print #2, Format(yy7, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx4, "0.0000"); ", "; Print #2, Format(zz4, "0.0000"); ", "; Print #2, Format(yy4, "0.0000"); ">, < "; Print #2, Format(xx8, "0.0000"); ", "; Print #2, Format(zz8, "0.0000"); ", "; Print #2, Format(yy8, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" Print #2, "object{" Print #2, "cylinder {< "; Print #2, Format(xx7, "0.0000"); ", "; Print #2, Format(zz7, "0.0000"); ", "; Print #2, Format(yy7, "0.0000"); ">, < "; Print #2, Format(xx5, "0.0000"); ", "; Print #2, Format(zz5, "0.0000"); ", "; Print #2, Format(yy5, "0.0000"); ">, "; Print #2, r_resist$ Print #2, kleur4$ Print #2, A2$ Print #2, "}" End If Next ix Next iy Form1.Text1.Text = iz DoEvents Next iz Close #2 End End Sub