// ====================================================================== // MC937A/MO603A – Computacao Grafica - 2023-S2 // Trabalho de laboratorio 04 - 2023-09-06 // Grafo Desorientado // // RA108231 - Oscar dos Santos Esgalha Neto // ====================================================================== background{ color rgb < 0.7, 0.7, 0.9 > } #declare tx_chao = texture{ pigment{ color rgb < 0.8, 0.8, 0.8 > } finish{ diffuse 0.8 ambient 0.1 } } #declare tcano = cylinder{ < 0.00, 0.00, 0.00 >, < 0.00, 0.00, 1.0 >, 0.2 texture{ pigment{ color rgb < 0.8, 0.8, 0.8 > } finish{ diffuse 0.8 ambient 0.1 } } } #macro tanque1(xx, yy, zz) #local tq = union { sphere { <0, 0, 0>, 1 } object{ tcano translate < 0,0,1 > } texture{ pigment{ color rgb < 0.8, 0.5, 0.5 > } finish{ diffuse 0.8 ambient 0.1 } } translate < xx, yy, zz > } tq #end #macro tanque2(xx, yy, zz) #local tq = union { cylinder{ < 0.00, 0.00, 0.00 >, < 0.00, 0.00, 4.0 >, 1 } cone{ < 0, 0, 4 >, 0.8, < 0, 0, 5.5 >, 0.2 } object{ tcano rotate 90*x rotate 90*z translate < 1,0,2.5 > } object{ tcano rotate 90*x rotate 90*z translate < -2,0,2.5 > } texture{ pigment{ color rgb < 0.5, 0.8, 0.8 > } finish{ diffuse 0.8 ambient 0.1 } } translate < xx, yy, zz > } tq #end #macro tanque3(xx, yy, zz) #local tq = union { cone{ < 0, 0, 0 >, 1, < 0, 0, 1 >, 0.5 } cylinder{ < 0.00, 0.00, 1 >, < 0.00, 0.00, 3.0 >, 0.5 } cone{ < 0, 0, 3 >, 0.5, < 0, 0, 4 >, 1 } object{ tcano rotate 90*y rotate 120*z translate < 0,0,2 > } object{ tcano rotate 90*y rotate 240*z translate < 0,0,2 > } object{ tcano rotate 90*y translate < 0,0,2 > } texture{ pigment{ color rgb < 0.5, 0.8, 0.5 > } finish{ diffuse 0.8 ambient 0.1 } } translate < xx, yy, zz > } tq #end #macro tanque4(xx, yy, zz) #local tq = union { box{ <0,0,0>, <1,3,1> } box{ <2,0,0>, <3,3,1> } box{ <1,0.6,0.3>, <2,1,0.6> } box{ <1,1.8,0.3>, <2,2.2,0.6> } object{ tcano rotate 90*y rotate 90*z translate < 0.5,3,0.5 > } object{ tcano rotate 90*y rotate 90*z translate < 2.5,3,0.5 > } object{ tcano rotate 90*y rotate 90*z translate < 0.5,-1,0.5 > } object{ tcano rotate 90*y rotate 90*z translate < 2.5,-1,0.5 > } texture{ pigment{ color rgb < 0.5, 0.8, 0.8 > } finish{ diffuse 0.8 ambient 0.1 } } translate < xx, yy, zz > } tq #end #macro interpola1(tt, t0, v0, t1, v1) #local ss = (tt - t0) / (t1 - t0); #local vv = (1 - ss) * v0 + ss * v1; vv #end #macro interpola3(tt, ta, tb, v0, v1, v2, v3) #local v01 = interpola1(tt, ta, v0, tb, v1); #local v12 = interpola1(tt, ta, v1, tb, v2); #local v23 = interpola1(tt, ta, v2, tb, v3); #local v012 = interpola1(tt, ta, v01, tb, v12); #local v123 = interpola1(tt, ta, v12, tb, v23); #local v0123 = interpola1(tt, ta, v012, tb, v123); v0123 #end #include "bezpoly.inc" #macro teste_interpola3(p0, p1, n, raio, v1, v2) union { // object{ bezpoly(p0, v1, v2, p1, 1.5*raio) } #local i = 1; #while (i <= n) #local centro = interpola3(i, 0, n, p0, v1, v2, p1); object{ sphere { <0, 0, 0>, raio } texture{ pigment{ color rgb < 0.8, 0.5, 0.5 > } finish{ diffuse 0.8 ambient 0.1 } } translate < centro.x, centro.y, centro.z > } #local i = i + 1; #end } #end #local tanque1_pos = <0, 0, 5>; #local tanque2_pos = <10, -2, 1>; #local cano1 = < tanque1_pos.x+2, tanque1_pos.y, tanque1_pos.z + 2.7 >; #local cano2 = < tanque2_pos.x-2, tanque2_pos.y, tanque2_pos.z + 2.7 >; #include "eixos.inc" union { // object{ eixos(10) } object { tanque1(-6, +5, 0) } object { tanque2(-2, +5, 0) } object { tanque3(+2, +5, 0) } object { tanque4(+6, +5, 0) } object { tanque2(tanque1_pos.x, tanque1_pos.y, tanque1_pos.z) } object { tanque2(tanque2_pos.x, tanque2_pos.y, tanque2_pos.z) } object { teste_interpola3(cano1, cano2, 300, 0.1, <6, 3, 0>, <9, 3, 11>) } box{ < -14, -14, -2 >, < +14, +14, -0.5 > texture{ tx_chao } } } #local cmin = < -9, -8, -1 >; #local cmax = < +14, +11, +8 >; #include "camlight.inc" #declare centro_cena = (cmin+cmax)/2; #declare raio_cena = 0.5*vlength(cmin-cmax); #declare dir_camera = < 20, 40, 30 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)