// Persistence of Vision Ray Tracer version 3.5 Include File // File: geodome1.inc // Last updated: 6 SET 2002 // Description: Geodesic Dome tests - sub-divide a triangle // AUTHOR: Joćo Paulo Silva // Macro that calculates a point along a segment -----[START] #macro Seg_Point(Start,End,length) #local tComp = VDist(Start, End); #local Pc = Start - End; #local ttemp = VWith_Len(Pc, tComp * length ); (ttemp + End) #end // Macro that calculates a point along a segment -----[END] // Macro that sub-divides a triangle -----[START] #macro Div_Point(I1,I2,I3,Arr1,Level,Count) #local P1 = Arr1[I1-1]; #local P2 = Arr1[I2-1]; #local P3 = Arr1[I3-1]; #local Parr = array [10]; #local Parr[0] = P1; #local Parr[1] = P2; #local Parr[2] = P3; #local Parr[3] = VWith_Len(Seg_Point(P1,P2,2/3),1); #local Parr[4] = VWith_Len(Seg_Point(P1,P3,2/3),1); #local Parr[5] = VWith_Len(Seg_Point(P1,P2,1/3),1); #local Parr[7] = VWith_Len(Seg_Point(P1,P3,1/3),1); #local Parr[6] = VWith_Len(Seg_Point(Parr[5],Parr[7],1/2),1); #local Parr[8] = VWith_Len(Seg_Point(P2,P3,2/3),1); #local Parr[9] = VWith_Len(Seg_Point(P2,P3,1/3),1); //--------------- #if (Count < Level) Div_Point(1,4,5,Parr,Level,Count+1) Div_Point(4,6,7,Parr,Level,Count+1) Div_Point(4,5,7,Parr,Level,Count+1) Div_Point(5,7,8,Parr,Level,Count+1) Div_Point(2,6,9,Parr,Level,Count+1) Div_Point(6,7,9,Parr,Level,Count+1) Div_Point(7,9,10,Parr,Level,Count+1) Div_Point(7,8,10,Parr,Level,Count+1) Div_Point(3,8,10,Parr,Level,Count+1) #else #local meC = 0; #while (meC < 10) sphere { Parr[meC], 0.011 texture {pigment {rgb <1,1,0>} finish { reflection 0} } } #local meC = meC + 1; #end #end //if #end // Macro that sub-divides a triangle -----[END]