/* * H E X A C O N E - G A D G E T S * nouveau projet du Thu Dec 5 11:37:05 AM UTC 2024 */ // ======================================================= #macro Base_hexapole () prism { linear_sweep linear_spline 0, // sweep the following shape from here ... 1, // ... up through here 7, // the number of points making up the shape ... <3,5>, <-3,5>, <-5,0>, <-3,-5>, <3, -5>, <5,0>, <3,5> #if (rand(Rng1) < 0.5) texture { T_Beton_1 } #else texture { T_Beton_2 } #end // if } #end // macro // ------------------------------------------------------ ## #macro HexaPole_tubes () #local R = 0.06; #local E = 0.666666; #local H = H_cone*4; union { #for (A, 0, 359, 60) #local Xp = E * cos(radians(A)); #local Zp = E * sin(radians(A)); #local Ha = rand(Rng1); union { cylinder { 0, y*H, R } sphere { 0, R*2 scale <1, 0.666, 1> } sphere { 0, R*2 scale <1, 0.666, 1> translate y*H } #if (Ha < 0.30) texture { T_Chrome_1A } #elseif (Ha < 0.60) texture { T_Chrome_4D } #elseif (Ha < 0.90) texture { T_Brass_2C } #else texture { Soft_Silver } #end translate } #end } #undef E #undef H #undef R #end // ------------------------------------------------------ ## #macro HexaPole () union { object { Base_hexapole () scale <0.33, 0.2, 0.33> } object { HexaPole_tubes () translate y*0.2 } rotate y*(33*rand(Rng1)) } #end // macro // ======================================================= #declare OpenBox = object { union { #local R = 0.010; /* les verticales */ cylinder { <-1, -1, -1>, <-1, 1, -1>, R } cylinder { < 1, -1, -1>, < 1, 1, -1>, R } cylinder { <-1, -1, 1>, <-1, 1, 1>, R } cylinder { < 1, -1, 1>, < 1, 1, 1>, R } /* en bas */ cylinder { < 1, -1, 1>, <-1, -1, 1>, R } cylinder { < 1, -1, -1>, <-1, -1, -1>, R } cylinder { <-1, -1, 1>, <-1, -1, -1>, R } cylinder { < 1, -1, 1>, < 1, -1, -1>, R } /* en haut */ cylinder { < 1, 1, 1>, <-1, 1, 1>, R } cylinder { < 1, 1, -1>, <-1, 1, -1>, R } cylinder { <-1, 1, 1>, <-1, 1, -1>, R } cylinder { < 1, 1, 1>, < 1, 1, -1>, R } #undef R texture { Soft_Silver scale 6.50 } } } // ======================================================= /* * first written macro for testing the generation of * differente instances of the same shape. */ #macro Bubble () sphere { 0, 0.070 #local R = rand(Rng1); #if ( R < 0.333 ) texture { Ruby_Glass } #elseif ( R < 0.666 ) texture { Orange_Glass } #else texture { Gold_Nugget } #end #undef R scale <1.414, 1.000, 1.414> } #end #macro Un_Machin () union { #for (Y, 1, 8, 1) object { Bubble() translate y*Y*0.11 } #end } #end #declare Les_Machins = object { union { #local Rk = 3.90 + NormClock; #for (foo, 0, 359, 45) #local Xpos = Rk * sin(radians(foo)); #local Zpos = Rk * cos(radians(foo)); object { Un_Machin () translate } #end #undef Rk } } // =======================================================