// MC937 - Interpolação Linear // Nome: Michell Henrique Lucino RA: 242056 // // Cores e Texturas // background{ color rgb < 1.0, 1.0, 1.0 > } #declare tx_plastico = texture{ pigment{ color rgb < 1.00, 0.00, 0.25 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_metal = texture{ pigment{ color rgb < 0.90, 0.90, 0.90 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } // Peças // #declare peao = union{ sphere { <0, 0, 0>, 0.400 texture{ tx_metal } } cylinder{ < 0.00, 0.00, 0.00 >, < 0.00, 0.00, -1.00 >, 0.25 texture{ tx_metal } } cylinder{ < 0.00, 0.00, -1.00 >, < 0.00, 0.00, -1.25 >, 0.6 texture{ tx_metal } } } #declare peao_2 = union{ sphere { <5, 5, 10>, 0.400 texture{ tx_metal } } cylinder{ < 5.00, 5.00, 10.00 >, < 5.00, 5.00, 9.00 >, 0.25 texture{ tx_metal } } cylinder{ < 5.00, 5.00, 9.00 >, < 5.00, 5.00, 8.75 >, 0.6 texture{ tx_metal } } } #macro interpola_1(w, w0, v0, w1, v1) #local ss = (w - w0) / (w1 - w0); #local vv = (1 - ss) * v0 + ss * v1; vv #end #macro interpola_3(w, w0, w1, v0, v1, v2, v3) #local v01 = interpola_1(w, w0, v0, w1, v1); #local v12 = interpola_1(w, w0, v1, w1, v2); #local v23 = interpola_1(w, w0, v2, w1, v3); #local v012 = interpola_1(w, w0, v01, w1, v12); #local v123 = interpola_1(w, w0, v12, w1, v23); #local v0123 = interpola_1(w, w0, v012, w1, v123); v0123 #end #macro teste_interpola_1(p0, p1, n, raio) union { #local k = n; #while (k != 0) #local centro = interpola_1(k, 0, p0, n, p1); sphere { centro, raio texture { tx_plastico } } #local k = k - 1; #end } #end #macro teste_interpola_3(p0, p1, p2, p3, n, raio) union { #local k = n; #while (k != 0) #local centro = interpola_3(k, 0, n, p0, p1, p2, p3); sphere { centro, raio texture { tx_plastico } } #local k = k - 1; #end } #end #include "eixos.inc" union { object { eixos(10.00) } //object{ teste_interpola_1(< 0.00, 0.00, 0.00 >, < -2.00, 0.00, 4.00 >, 10, 0.5) } object { teste_interpola_3(< 0.00, 0.00, 0.00 >, < -2.00, 3.00, 4.00 >, < -10.00, 8.00, -6.00 >, < 5.00, 5.00, 10.00 >, 250, 0.25) } object { peao } object { peao_2 } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 15.0; #declare dir_camera = < 5.00, 2.00, 2.0 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)