Here's the code.
Use the basic vector class given earlier in this thread.
This defines the tetrahedron axes and the mapping lookup table:
Vector corners[4]
corners[0] = new Vector()
corners[1] = new Vector()
corners[2] = new Vector()
corners[3] = new Vector()
corners[0].Init(0, 1, 0)
corners[1].Init(0, -1/3, sqrt(8/9))
corners[2].Init(-sqrt(2/3), -1/3, -(1/3) * sqrt(2))
corners[3].Init(sqrt(2/3), -1/3, -(1/3) * sqrt(2))
Vector normals[4]
Vector crosses[4*3]
Vector C = new Vector()
Vector temp1 = new Vector()
Vector temp2 = new Vector()
int triangles[4,3]
triangles[0 , 0] = 0
triangles[0 , 1] = 1
triangles[0 , 2] = 2
triangles[1 , 0] = 2
triangles[1 , 1] = 3
triangles[1 , 2] = 0
triangles[2 , 0] = 1
triangles[2 , 1] = 0
triangles[2 , 2] = 3
triangles[3 , 0] = 3
triangles[3 , 1] = 2
triangles[3 , 2] = 1
Vector posit = new Vector()
Vector bary = new Vector()
int it = 0
repeat
normals[it] = new Vector()
crosses[it*3 + 0] = new Vector()
crosses[it*3 + 1] = new Vector()
crosses[it*3 + 2] = new Vector()
Vector cr1 = new Vector()
cr1.Subtract(corners[triangles[it, 2]], corners[triangles[it, 0]])
Vector cr2 = new Vector()
cr2.Subtract(corners[triangles[it, 1]], corners[triangles[it, 0]])
normals[it].Cross(cr1, cr2)
normals[it].Normalise()
crosses[it*3 + 0].Cross(corners[triangles[it, 2]], corners[triangles[it, 1]])
crosses[it*3 + 1].Cross(corners[triangles[it, 0]], corners[triangles[it, 2]])
crosses[it*3 + 2].Cross(corners[triangles[it, 1]], corners[triangles[it, 0]])
until (it=it+1)>=4
int maxI = 29
int maxJ = 29
Vector point[29, 29]
it = 0
repeat
int it2 = 0
repeat
point[it, it2] = new Vector()
until (it2=it2+1)>=maxJ
until (it=it+1)>=maxI
point[0, 0].Init(-0.000000, 1.000000, -0.000000)
point[0, 1].Init(0.000000, 0.998399, 0.056569)
point[0, 2].Init(0.000000, 0.991307, 0.131572)
point[0, 3].Init(0.000000, 0.973080, 0.230469)
point[0, 4].Init(0.000000, 0.936487, 0.350702)
point[0, 5].Init(0.000000, 0.874871, 0.484356)
point[0, 6].Init(0.000000, 0.784014, 0.620742)
point[0, 7].Init(0.000000, 0.664315, 0.747452)
point[0, 8].Init(0.000000, 0.521831, 0.853049)
point[0, 9].Init(0.000000, 0.367160, 0.930158)
point[0, 10].Init(-0.000000, 0.211831, 0.977306)
point[0, 11].Init(-0.000000, 0.069162, 0.997605)
point[0, 12].Init(0.000000, -0.054627, 0.998507)
point[0, 13].Init(-0.000000, -0.154932, 0.987925)
point[0, 14].Init(0.000000, -0.221023, 0.975269)
point[0, 15].Init(-0.000000, -0.154932, 0.987925)
point[0, 16].Init(0.000000, -0.054627, 0.998507)
point[0, 17].Init(-0.000000, 0.069162, 0.997605)
point[0, 18].Init(-0.000000, 0.211831, 0.977306)
point[0, 19].Init(0.000000, 0.367160, 0.930158)
point[0, 20].Init(0.000000, 0.521831, 0.853049)
point[0, 21].Init(0.000000, 0.664315, 0.747452)
point[0, 22].Init(0.000000, 0.784014, 0.620742)
point[0, 23].Init(0.000000, 0.874871, 0.484356)
point[0, 24].Init(0.000000, 0.936487, 0.350702)
point[0, 25].Init(0.000000, 0.973080, 0.230469)
point[0, 26].Init(0.000000, 0.991307, 0.131572)
point[0, 27].Init(0.000000, 0.998399, 0.056569)
point[0, 28].Init(0.000000, 1.000000, -0.000000)
point[1, 0].Init(-0.048990, 0.998399, -0.028285)
point[1, 1].Init(-0.077757, 0.995961, 0.044893)
point[1, 2].Init(-0.101182, 0.985334, 0.137398)
point[1, 3].Init(-0.121577, 0.960448, 0.250516)
point[1, 4].Init(-0.139000, 0.914261, 0.380533)
point[1, 5].Init(-0.152516, 0.840842, 0.519349)
point[1, 6].Init(-0.160861, 0.737644, 0.655747)
point[1, 7].Init(-0.162931, 0.607311, 0.777577)
point[1, 8].Init(-0.158176, 0.457943, 0.874796)
point[1, 9].Init(-0.146728, 0.301378, 0.942148)
point[1, 10].Init(-0.128930, 0.149402, 0.980335)
point[1, 11].Init(-0.106630, 0.010238, 0.994246)
point[1, 12].Init(-0.082096, -0.111885, 0.990324)
point[1, 13].Init(-0.066067, -0.220480, 0.973151)
point[1, 14].Init(0.048105, -0.229677, 0.972077)
point[1, 15].Init(0.081081, -0.115864, 0.989950)
point[1, 16].Init(0.106321, 0.009009, 0.994291)
point[1, 17].Init(0.128888, 0.148895, 0.980417)
point[1, 18].Init(0.146778, 0.301067, 0.942239)
point[1, 19].Init(0.158272, 0.457703, 0.874905)
point[1, 20].Init(0.163071, 0.607129, 0.777690)
point[1, 21].Init(0.161030, 0.737515, 0.655851)
point[1, 22].Init(0.152693, 0.840759, 0.519431)
point[1, 23].Init(0.139166, 0.914213, 0.380589)
point[1, 24].Init(0.121719, 0.960423, 0.250546)
point[1, 25].Init(0.101292, 0.985322, 0.137405)
point[1, 26].Init(0.077824, 0.995956, 0.044883)
point[1, 27].Init(0.049018, 0.998397, -0.028300)
point[2, 0].Init(-0.113945, 0.991307, -0.065786)
point[2, 1].Init(-0.169581, 0.985334, 0.018928)
point[2, 2].Init(-0.216753, 0.968172, 0.125143)
point[2, 3].Init(-0.257142, 0.933392, 0.250315)
point[2, 4].Init(-0.290242, 0.874377, 0.388876)
point[2, 5].Init(-0.314221, 0.786440, 0.531768)
point[2, 6].Init(-0.326869, 0.668951, 0.667579)
point[2, 7].Init(-0.326477, 0.526592, 0.784929)
point[2, 8].Init(-0.312500, 0.368931, 0.875348)
point[2, 9].Init(-0.284659, 0.207071, 0.935997)
point[2, 10].Init(-0.243821, 0.051782, 0.968437)
point[2, 11].Init(-0.191975, -0.091384, 0.977136)
point[2, 12].Init(-0.128816, -0.221749, 0.966558)
point[2, 13].Init(-0.001597, -0.288439, 0.957497)
point[2, 14].Init(0.124471, -0.220867, 0.967329)
point[2, 15].Init(0.191008, -0.092266, 0.977243)
point[2, 16].Init(0.243511, 0.051053, 0.968554)
point[2, 17].Init(0.284651, 0.206488, 0.936129)
point[2, 18].Init(0.312633, 0.368441, 0.875507)
point[2, 19].Init(0.326696, 0.526189, 0.785108)
point[2, 20].Init(0.327156, 0.668643, 0.667746)
point[2, 21].Init(0.314537, 0.786221, 0.531905)
point[2, 22].Init(0.290551, 0.874232, 0.388972)
point[2, 23].Init(0.257415, 0.933302, 0.250368)
point[2, 24].Init(0.216974, 0.968121, 0.125154)
point[2, 25].Init(0.169738, 0.985308, 0.018903)
point[2, 26].Init(0.114030, 0.991294, -0.065835)
point[3, 0].Init(-0.199591, 0.973080, -0.115234)
point[3, 1].Init(-0.277741, 0.960448, -0.019968)
point[3, 2].Init(-0.345350, 0.933392, 0.097534)
point[3, 3].Init(-0.402506, 0.885430, 0.232387)
point[3, 4].Init(-0.447531, 0.810735, 0.377392)
point[3, 5].Init(-0.477655, 0.706116, 0.522729)
point[3, 6].Init(-0.489974, 0.572725, 0.657199)
point[3, 7].Init(-0.482391, 0.416697, 0.770495)
point[3, 8].Init(-0.453515, 0.247765, 0.856117)
point[3, 9].Init(-0.402304, 0.076831, 0.912277)
point[3, 10].Init(-0.328549, -0.085346, 0.940623)
point[3, 11].Init(-0.230617, -0.231357, 0.945140)
point[3, 12].Init(-0.088550, -0.334680, 0.938162)
point[3, 13].Init(0.087116, -0.334182, 0.938474)
point[3, 14].Init(0.229077, -0.231382, 0.945509)
point[3, 15].Init(0.328016, -0.085969, 0.940752)
point[3, 16].Init(0.402177, 0.076119, 0.912392)
point[3, 17].Init(0.453616, 0.247069, 0.856265)
point[3, 18].Init(0.482611, 0.416056, 0.770704)
point[3, 19].Init(0.490318, 0.572216, 0.657386)
point[3, 20].Init(0.478058, 0.705730, 0.522882)
point[3, 21].Init(0.447940, 0.810459, 0.377498)
point[3, 22].Init(0.402881, 0.885244, 0.232444)
point[3, 23].Init(0.345663, 0.933275, 0.097542)
point[3, 24].Init(0.277975, 0.960380, -0.020008)
point[3, 25].Init(0.199737, 0.973040, -0.115318)
point[4, 0].Init(-0.303716, 0.936487, -0.175351)
point[4, 1].Init(-0.399051, 0.914262, -0.069889)
point[4, 2].Init(-0.481897, 0.874377, 0.056920)
point[4, 3].Init(-0.550596, 0.810735, 0.198878)
point[4, 4].Init(-0.602318, 0.718530, 0.347748)
point[4, 5].Init(-0.633502, 0.595954, 0.493471)
point[4, 6].Init(-0.640569, 0.445452, 0.625495)
point[4, 7].Init(-0.620500, 0.273958, 0.734798)
point[4, 8].Init(-0.569830, 0.091241, 0.816682)
point[4, 9].Init(-0.485719, -0.090167, 0.869452)
point[4, 10].Init(-0.365861, -0.256071, 0.894748)
point[4, 11].Init(-0.203237, -0.385654, 0.899981)
point[4, 12].Init(-0.000300, -0.437949, 0.899000)
point[4, 13].Init(0.202491, -0.385591, 0.900176)
point[4, 14].Init(0.365252, -0.256439, 0.894891)
point[4, 15].Init(0.485484, -0.090864, 0.869511)
point[4, 16].Init(0.569854, 0.090435, 0.816755)
point[4, 17].Init(0.620699, 0.273168, 0.734923)
point[4, 18].Init(0.640900, 0.444764, 0.625645)
point[4, 19].Init(0.633928, 0.595400, 0.493594)
point[4, 20].Init(0.602771, 0.718110, 0.347830)
point[4, 21].Init(0.551025, 0.810434, 0.198915)
point[4, 22].Init(0.482266, 0.874174, 0.056913)
point[4, 23].Init(0.399335, 0.914133, -0.069943)
point[4, 24].Init(0.303899, 0.936408, -0.175456)
point[5, 0].Init(-0.419463, 0.874872, -0.242177)
point[5, 1].Init(-0.526027, 0.840843, -0.127591)
point[5, 2].Init(-0.617635, 0.786440, 0.006240)
point[5, 3].Init(-0.691524, 0.706116, 0.152297)
point[5, 4].Init(-0.744110, 0.595954, 0.301893)
point[5, 5].Init(-0.771151, 0.455084, 0.445224)
point[5, 6].Init(-0.767991, 0.286709, 0.572702)
point[5, 7].Init(-0.729461, 0.098354, 0.676915)
point[5, 8].Init(-0.649434, -0.098544, 0.754006)
point[5, 9].Init(-0.522934, -0.287521, 0.802416)
point[5, 10].Init(-0.346212, -0.445029, 0.825885)
point[5, 11].Init(-0.122550, -0.539677, 0.832905)
point[5, 12].Init(0.122220, -0.539710, 0.832932)
point[5, 13].Init(0.345847, -0.445268, 0.825910)
point[5, 14].Init(0.522664, -0.288091, 0.802388)
point[5, 15].Init(0.649360, -0.099355, 0.753963)
point[5, 16].Init(0.729563, 0.097471, 0.676933)
point[5, 17].Init(0.768229, 0.285870, 0.572803)
point[5, 18].Init(0.771529, 0.454389, 0.445280)
point[5, 19].Init(0.744541, 0.595404, 0.301914)
point[5, 20].Init(0.691949, 0.705702, 0.152288)
point[5, 21].Init(0.618010, 0.786146, 0.006204)
point[5, 22].Init(0.526322, 0.840647, -0.127659)
point[5, 23].Init(0.419657, 0.874748, -0.242289)
point[6, 0].Init(-0.537578, 0.784015, -0.310371)
point[6, 1].Init(-0.648324, 0.737645, -0.188563)
point[6, 2].Init(-0.741574, 0.668952, -0.050713)
point[6, 3].Init(-0.814138, 0.572726, 0.095730)
point[6, 4].Init(-0.861979, 0.445452, 0.242001)
point[6, 5].Init(-0.879970, 0.286709, 0.378749)
point[6, 6].Init(-0.861638, 0.100529, 0.497467)
point[6, 7].Init(-0.798817, -0.104640, 0.592403)
point[6, 8].Init(-0.682539, -0.313127, 0.660373)
point[6, 9].Init(-0.506393, -0.500953, 0.701863)
point[6, 10].Init(-0.272604, -0.636116, 0.721834)
point[6, 11].Init(-0.000077, -0.686468, 0.727160)
point[6, 12].Init(0.272440, -0.636268, 0.721761)
point[6, 13].Init(0.506244, -0.501283, 0.701735)
point[6, 14].Init(0.682408, -0.313805, 0.660186)
point[6, 15].Init(0.798805, -0.105488, 0.592269)
point[6, 16].Init(0.861747, 0.099653, 0.497454)
point[6, 17].Init(0.880234, 0.285941, 0.378717)
point[6, 18].Init(0.862324, 0.444818, 0.241939)
point[6, 19].Init(0.814498, 0.572226, 0.095654)
point[6, 20].Init(0.741902, 0.668582, -0.050791)
point[6, 21].Init(0.648589, 0.737391, -0.188645)
point[6, 22].Init(0.537754, 0.783854, -0.310472)
point[7, 0].Init(-0.647312, 0.664316, -0.373726)
point[7, 1].Init(-0.754867, 0.607312, -0.247687)
point[7, 2].Init(-0.843007, 0.526592, -0.109727)
point[7, 3].Init(-0.908463, 0.416698, 0.032515)
point[7, 4].Init(-0.946603, 0.273958, 0.169970)
point[7, 5].Init(-0.950956, 0.098354, 0.293275)
point[7, 6].Init(-0.912445, -0.104640, 0.395595)
point[7, 7].Init(-0.819593, -0.323040, 0.473193)
point[7, 8].Init(-0.661696, -0.535180, 0.525110)
point[7, 9].Init(-0.435267, -0.709238, 0.554549)
point[7, 10].Init(-0.152616, -0.809504, 0.566932)
point[7, 11].Init(0.152586, -0.809563, 0.566856)
point[7, 12].Init(0.435255, -0.709380, 0.554376)
point[7, 13].Init(0.661579, -0.535610, 0.524819)
point[7, 14].Init(0.819503, -0.323692, 0.472903)
point[7, 15].Init(0.912447, -0.105390, 0.395390)
point[7, 16].Init(0.951061, 0.097601, 0.293185)
point[7, 17].Init(0.946815, 0.273308, 0.169835)
point[7, 18].Init(0.908716, 0.416158, 0.032363)
point[7, 19].Init(0.843248, 0.526179, -0.109856)
point[7, 20].Init(0.755067, 0.607024, -0.247783)
point[7, 21].Init(0.647448, 0.664140, -0.373804)
point[8, 0].Init(-0.738762, 0.521831, -0.426524)
point[8, 1].Init(-0.836684, 0.457943, -0.300414)
point[8, 2].Init(-0.914323, 0.368932, -0.167040)
point[8, 3].Init(-0.968176, 0.247766, -0.035302)
point[8, 4].Init(-0.992182, 0.091242, 0.085147)
point[8, 5].Init(-0.977705, -0.098544, 0.185424)
point[8, 6].Init(-0.913169, -0.313127, 0.260911)
point[8, 7].Init(-0.785606, -0.535180, 0.310491)
point[8, 8].Init(-0.585341, -0.736999, 0.337947)
point[8, 9].Init(-0.315308, -0.882042, 0.350118)
point[8, 10].Init(0.000045, -0.935572, 0.353135)
point[8, 11].Init(0.315390, -0.882082, 0.349943)
point[8, 12].Init(0.585407, -0.737070, 0.337677)
point[8, 13].Init(0.785540, -0.535487, 0.310128)
point[8, 14].Init(0.913106, -0.313592, 0.260572)
point[8, 15].Init(0.977700, -0.099107, 0.185149)
point[8, 16].Init(0.992251, 0.090659, 0.084959)
point[8, 17].Init(0.968301, 0.247248, -0.035513)
point[8, 18].Init(0.914461, 0.368511, -0.167213)
point[8, 19].Init(0.836805, 0.457647, -0.300526)
point[8, 20].Init(0.738849, 0.521667, -0.426574)
point[9, 0].Init(-0.805540, 0.367161, -0.465079)
point[9, 1].Init(-0.889287, 0.301379, -0.344004)
point[9, 2].Init(-0.952927, 0.207072, -0.221476)
point[9, 3].Init(-0.991207, 0.076832, -0.107732)
point[9, 4].Init(-0.995827, -0.090166, -0.014079)
point[9, 5].Init(-0.956380, -0.287521, 0.051667)
point[9, 6].Init(-0.861028, -0.500953, 0.087619)
point[9, 7].Init(-0.697887, -0.709238, 0.099678)
point[9, 8].Init(-0.460866, -0.882042, 0.098006)
point[9, 9].Init(-0.161821, -0.982388, 0.093427)
point[9, 10].Init(0.162047, -0.982359, 0.093334)
point[9, 11].Init(0.461036, -0.881979, 0.097774)
point[9, 12].Init(0.698006, -0.709159, 0.099397)
point[9, 13].Init(0.861036, -0.500998, 0.087281)
point[9, 14].Init(0.956321, -0.287785, 0.051274)
point[9, 15].Init(0.995786, -0.090561, -0.014434)
point[9, 16].Init(0.991213, 0.076374, -0.108000)
point[9, 17].Init(0.952965, 0.206655, -0.221701)
point[9, 18].Init(0.889340, 0.301082, -0.344129)
point[9, 19].Init(0.805587, 0.367023, -0.465106)
point[10, 0].Init(-0.846372, 0.211831, -0.488653)
point[10, 1].Init(-0.913459, 0.149404, -0.378511)
point[10, 2].Init(-0.960602, 0.051784, -0.273062)
point[10, 3].Init(-0.978879, -0.085344, -0.185777)
point[10, 4].Init(-0.957805, -0.256070, -0.130526)
point[10, 5].Init(-0.888344, -0.445029, -0.113112)
point[10, 6].Init(-0.761429, -0.636116, -0.124834)
point[10, 7].Init(-0.567286, -0.809504, -0.151297)
point[10, 8].Init(-0.305802, -0.935572, -0.176606)
point[10, 9].Init(0.000194, -0.982359, -0.187004)
point[10, 10].Init(0.306124, -0.935441, -0.176741)
point[10, 11].Init(0.567466, -0.809338, -0.151505)
point[10, 12].Init(0.761468, -0.636016, -0.125098)
point[10, 13].Init(0.888290, -0.445043, -0.113476)
point[10, 14].Init(0.957698, -0.256225, -0.131012)
point[10, 15].Init(0.978763, -0.085696, -0.186221)
point[10, 16].Init(0.960540, 0.051325, -0.273364)
point[10, 17].Init(0.913460, 0.149043, -0.378651)
point[10, 18].Init(0.846395, 0.211710, -0.488666)
point[11, 0].Init(-0.863952, 0.069161, -0.498803)
point[11, 1].Init(-0.914357, 0.010245, -0.404778)
point[11, 2].Init(-0.942214, -0.091378, -0.322308)
point[11, 3].Init(-0.933826, -0.231356, -0.272844)
point[11, 4].Init(-0.881026, -0.385655, -0.273979)
point[11, 5].Init(-0.782592, -0.539677, -0.310320)
point[11, 6].Init(-0.629778, -0.686468, -0.363513)
point[11, 7].Init(-0.414619, -0.809563, -0.415571)
point[11, 8].Init(-0.145365, -0.882082, -0.448107)
point[11, 9].Init(0.145843, -0.881978, -0.448156)
point[11, 10].Init(0.414940, -0.809338, -0.415688)
point[11, 11].Init(0.629891, -0.686282, -0.363668)
point[11, 12].Init(0.782554, -0.539604, -0.310543)
point[11, 13].Init(0.880901, -0.385631, -0.274413)
point[11, 14].Init(0.933568, -0.231458, -0.273640)
point[11, 15].Init(0.941981, -0.091937, -0.322831)
point[11, 16].Init(0.914279, 0.009573, -0.404973)
point[11, 17].Init(0.863955, 0.069105, -0.498805)
point[12, 0].Init(-0.864732, -0.054634, -0.499253)
point[12, 1].Init(-0.898697, -0.111854, -0.424066)
point[12, 2].Init(-0.901480, -0.221739, -0.371707)
point[12, 3].Init(-0.856750, -0.334681, -0.392387)
point[12, 4].Init(-0.778709, -0.437948, -0.449238)
point[12, 5].Init(-0.660232, -0.539709, -0.522310)
point[12, 6].Init(-0.488845, -0.636267, -0.596820)
point[12, 7].Init(-0.262477, -0.709380, -0.654130)
point[12, 8].Init(0.000266, -0.737070, -0.675816)
point[12, 9].Init(0.262923, -0.709159, -0.654190)
point[12, 10].Init(0.489072, -0.636016, -0.596902)
point[12, 11].Init(0.660215, -0.539604, -0.522440)
point[12, 12].Init(0.778523, -0.438029, -0.449480)
point[12, 13].Init(0.856453, -0.334649, -0.393062)
point[12, 14].Init(0.900716, -0.221830, -0.373500)
point[12, 15].Init(0.898368, -0.113855, -0.424231)
point[12, 16].Init(0.864736, -0.054543, -0.499256)
point[13, 0].Init(-0.855563, -0.154968, -0.493960)
point[13, 1].Init(-0.875864, -0.220360, -0.429305)
point[13, 2].Init(-0.830026, -0.288446, -0.477343)
point[13, 3].Init(-0.769190, -0.334177, -0.544676)
point[13, 4].Init(-0.678333, -0.385589, -0.625448)
point[13, 5].Init(-0.542338, -0.445267, -0.712465)
point[13, 6].Init(-0.354600, -0.501283, -0.789287)
point[13, 7].Init(-0.123718, -0.535610, -0.835354)
point[13, 8].Init(0.124191, -0.535487, -0.835362)
point[13, 9].Init(0.354930, -0.500998, -0.789320)
point[13, 10].Init(0.542418, -0.445043, -0.712544)
point[13, 11].Init(0.678100, -0.385631, -0.625676)
point[13, 12].Init(0.768629, -0.334649, -0.545179)
point[13, 13].Init(0.829208, -0.288478, -0.478743)
point[13, 14].Init(0.871422, -0.225189, -0.435790)
point[13, 15].Init(0.855668, -0.154194, -0.494020)
point[14, 0].Init(-0.844553, -0.221298, -0.487603)
point[14, 1].Init(-0.817868, -0.229784, -0.527534)
point[14, 2].Init(-0.775523, -0.220851, -0.591430)
point[14, 3].Init(-0.704305, -0.231379, -0.671132)
point[14, 4].Init(-0.592376, -0.256438, -0.763760)
point[14, 5].Init(-0.433558, -0.288090, -0.853833)
point[14, 6].Init(-0.230535, -0.313804, -0.921076)
point[14, 7].Init(0.000205, -0.323692, -0.946162)
point[14, 8].Init(0.230890, -0.313592, -0.921059)
point[14, 9].Init(0.433756, -0.287785, -0.853836)
point[14, 10].Init(0.592309, -0.256224, -0.763884)
point[14, 11].Init(0.703763, -0.231457, -0.671673)
point[14, 12].Init(0.773820, -0.221830, -0.593291)
point[14, 13].Init(0.813119, -0.225191, -0.536775)
point[14, 14].Init(0.845695, -0.215405, -0.488262)
point[15, 0].Init(-0.855563, -0.154968, -0.493960)
point[15, 1].Init(-0.816788, -0.115904, -0.565176)
point[15, 2].Init(-0.750819, -0.092270, -0.654031)
point[15, 3].Init(-0.650711, -0.085970, -0.754443)
point[15, 4].Init(-0.510279, -0.090864, -0.855195)
point[15, 5].Init(-0.328273, -0.099355, -0.939343)
point[15, 6].Init(-0.113518, -0.105488, -0.987920)
point[15, 7].Init(0.113805, -0.105390, -0.987897)
point[15, 8].Init(0.328506, -0.099107, -0.939288)
point[15, 9].Init(0.510393, -0.090560, -0.855159)
point[15, 10].Init(0.650654, -0.085696, -0.754523)
point[15, 11].Init(0.750570, -0.091937, -0.654364)
point[15, 12].Init(0.816579, -0.113855, -0.565894)
point[15, 13].Init(0.855668, -0.154194, -0.494020)
point[16, 0].Init(-0.864732, -0.054634, -0.499253)
point[16, 1].Init(-0.807923, 0.008998, -0.589219)
point[16, 2].Init(-0.717039, 0.051050, -0.695161)
point[16, 3].Init(-0.589068, 0.076118, -0.804491)
point[16, 4].Init(-0.422404, 0.090435, -0.901885)
point[16, 5].Init(-0.221460, 0.097471, -0.970286)
point[16, 6].Init(0.000065, 0.099653, -0.995022)
point[16, 7].Init(0.221624, 0.097601, -0.970235)
point[16, 8].Init(0.422549, 0.090659, -0.901794)
point[16, 9].Init(0.589138, 0.076374, -0.804415)
point[16, 10].Init(0.717010, 0.051325, -0.695170)
point[16, 11].Init(0.807856, 0.009573, -0.589302)
point[16, 12].Init(0.864736, -0.054543, -0.499256)
point[17, 0].Init(-0.863952, 0.069161, -0.498803)
point[17, 1].Init(-0.784623, 0.148892, -0.601829)
point[17, 2].Init(-0.668387, 0.206487, -0.714578)
point[17, 3].Init(-0.514740, 0.247069, -0.820975)
point[17, 4].Init(-0.326114, 0.273168, -0.905002)
point[17, 5].Init(-0.111948, 0.285870, -0.951707)
point[17, 6].Init(0.112138, 0.285941, -0.951663)
point[17, 7].Init(0.326326, 0.273308, -0.904883)
point[17, 8].Init(0.514906, 0.247248, -0.820817)
point[17, 9].Init(0.668481, 0.206655, -0.714441)
point[17, 10].Init(0.784652, 0.149043, -0.601754)
point[17, 11].Init(0.863955, 0.069105, -0.498805)
point[18, 0].Init(-0.846372, 0.211831, -0.488653)
point[18, 1].Init(-0.742614, 0.301067, -0.598233)
point[18, 2].Init(-0.601895, 0.368441, -0.708501)
point[18, 3].Init(-0.426144, 0.416056, -0.803305)
point[18, 4].Init(-0.221374, 0.444763, -0.867859)
point[18, 5].Init(0.000140, 0.454389, -0.890803)
point[18, 6].Init(0.221637, 0.444818, -0.867764)
point[18, 7].Init(0.426330, 0.416159, -0.803153)
point[18, 8].Init(0.602041, 0.368511, -0.708340)
point[18, 9].Init(0.742694, 0.301082, -0.598127)
point[18, 10].Init(0.846395, 0.211710, -0.488666)
point[19, 0].Init(-0.805540, 0.367161, -0.465079)
point[19, 1].Init(-0.678553, 0.457703, -0.574520)
point[19, 2].Init(-0.516575, 0.526189, -0.675482)
point[19, 3].Init(-0.324154, 0.572217, -0.753321)
point[19, 4].Init(-0.110501, 0.595400, -0.795794)
point[19, 5].Init(0.110805, 0.595404, -0.795749)
point[19, 6].Init(0.324411, 0.572226, -0.753203)
point[19, 7].Init(0.516761, 0.526179, -0.675346)
point[19, 8].Init(0.678666, 0.457647, -0.574432)
point[19, 9].Init(0.805587, 0.367023, -0.465106)
point[20, 0].Init(-0.738762, 0.521831, -0.426524)
point[20, 1].Init(-0.591964, 0.607129, -0.530069)
point[20, 2].Init(-0.414707, 0.668644, -0.617198)
point[20, 3].Init(-0.213800, 0.705730, -0.675452)
point[20, 4].Init(0.000156, 0.718110, -0.695930)
point[20, 5].Init(0.214089, 0.705702, -0.675389)
point[20, 6].Init(0.414938, 0.668582, -0.617110)
point[20, 7].Init(0.592120, 0.607024, -0.530016)
point[20, 8].Init(0.738849, 0.521667, -0.426574)
point[21, 0].Init(-0.647312, 0.664316, -0.373726)
point[21, 1].Init(-0.487468, 0.737516, -0.467381)
point[21, 2].Init(-0.303375, 0.786221, -0.538350)
point[21, 3].Init(-0.102953, 0.810460, -0.576677)
point[21, 4].Init(0.103247, 0.810434, -0.576660)
point[21, 5].Init(0.303633, 0.786146, -0.538314)
point[21, 6].Init(0.487666, 0.737391, -0.467372)
point[21, 7].Init(0.647448, 0.664140, -0.373804)
point[22, 0].Init(-0.537578, 0.784015, -0.310371)
point[22, 1].Init(-0.373494, 0.840760, -0.391951)
point[22, 2].Init(-0.191583, 0.874232, -0.446110)
point[22, 3].Init(0.000138, 0.885244, -0.465127)
point[22, 4].Init(0.191845, 0.874174, -0.446111)
point[22, 5].Init(0.373717, 0.840647, -0.391979)
point[22, 6].Init(0.537754, 0.783854, -0.310472)
point[23, 0].Init(-0.419463, 0.874872, -0.242177)
point[23, 1].Init(-0.260017, 0.914213, -0.310815)
point[23, 2].Init(-0.088117, 0.933302, -0.348112)
point[23, 3].Init(0.088358, 0.933275, -0.348124)
point[23, 4].Init(0.260239, 0.914133, -0.310862)
point[23, 5].Init(0.419657, 0.874748, -0.242289)
point[24, 0].Init(-0.303716, 0.936487, -0.175351)
point[24, 1].Init(-0.156119, 0.960423, -0.230684)
point[24, 2].Init(0.000101, 0.968121, -0.250482)
point[24, 3].Init(0.156315, 0.960380, -0.230729)
point[24, 4].Init(0.303899, 0.936408, -0.175456)
point[25, 0].Init(-0.199591, 0.973080, -0.115234)
point[25, 1].Init(-0.068350, 0.985322, -0.156424)
point[25, 2].Init(0.068499, 0.985308, -0.156449)
point[25, 3].Init(0.199737, 0.973040, -0.115318)
point[26, 0].Init(-0.113945, 0.991307, -0.065786)
point[26, 1].Init(0.000042, 0.995956, -0.089839)
point[26, 2].Init(0.114030, 0.991294, -0.065835)
point[27, 0].Init(-0.048990, 0.998399, -0.028285)
point[27, 1].Init(0.049018, 0.998397, -0.028300)
point[28, 0].Init(0.000000, 1.000000, -0.000000)
Here is the inner loop:
float magnitude = 1
int ij = 0
posit.x = real(zri) ; convert z to vector for ease of use
posit.y = imag(zri)
posit.z = zj
ij = 0
repeat
magnitude = posit.Dot(normals[ij])
if (magnitude > 0) ; on wrong side of triangle
magnitude = posit.Magnitude()
; super simple way to get barycentric coordinates of triangle
bary.z = crosses[ij*3 + 0].Dot(posit)
bary.y = crosses[ij*3 + 1].Dot(posit)
bary.x = crosses[ij*3 + 2].Dot(posit)
if (bary.x >= 0 && bary.y >= 0 && bary.z >= 0)
bary.Divide(bary.x+bary.y+bary.z)
; now we use barycentric coordinates to do interpolated table lookup
float il = bary.x*28
float jl = bary.y*28
int floorI = floor(il)
int floorJ = floor(jl)
float fi = il - floorI
float fj = jl - floorJ
if (fi + fj) < 1
posit.Multiply(point[floorI, floorJ], (1 - (fi + fj)))
temp1.Multiply(point[floorI, floorJ+1], fj)
temp2.Multiply(point[floorI+1, floorJ], fi)
else
posit.Multiply(point[floorI+1, floorJ+1], (1 - ((1-fi) + (1-fj))))
temp1.Multiply(point[floorI, floorJ+1], (1-fi))
temp2.Multiply(point[floorI+1, floorJ], (1-fj))
endif
posit.AddEquals(temp1)
posit.AddEquals(temp2)
; Z^2 + c
magnitude = magnitude*magnitude
posit.MultiplyEquals(magnitude)
posit.AddEquals(C)
ij=10 ; break
endif
endif
until (ij = ij+1)>=4
zri = posit.x + flip(posit.y)
zj = posit.z
And to get this fractal: "
http://www.fractalforums.com/3d-fractal-generation/a-new-tetrahedral-mandelbulb/?action=post;quote=11415;num_replies=4;sesc=aee003da38f141169bfe35f4f08fee04" just change the last two lines to:
zri = -posit.x + flip(posit.y)
zj = -posit.z
It would be great to see some other people's renderings of these, or any tips on how I can improve the look of my renders using UltraFractal.