/* * 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 */ /* ======================================================= */ /* new 30 aout 2025 * * une idée à creuser davantage... */ // ------------------------------------------------------ ## #macro Chose_le_pied () merge { cylinder { 0, y/2, 0.07 } cylinder { 0, y/8, 0.37 } #local R = rand(Rng1); #if ( R < 0.52) texture { T_Beton_1 } #else texture { T_Beton_2 } #end } #end // macro // ------------------------------------------------------ ## /* * Il doit être possible de dissocier le noyau des tiges */ #macro Chose_le_corps () // = object merge { difference { cone { -1.2*y, 0.81, 0.2*y, 1.07 } sphere { 0.2*y 0.73 } } #local CK = NormClock * (9.876+rand(Rng1)); #for (Foo, 0, 7) #local CK2 = CK + Foo; #local C2X = 1.9 * sin(CK2+rand(Rng1)) * sin(CK*3); #local C2Z = 2.0 * (sin(-CK2+rand(Rng1)) * cos(CK*(rand(Rng1)))); #local R = 0.06+(0.04*Cos_010(NormClock)); #local H = 4.2; cylinder { 0, , R } sphere { , R } #end #local R = rand(Rng1); #if (R < 0.33) texture { tPlasticOrange } #elseif (R < 0.66) texture { tPlasticBlue } #else texture { tPlasticGreen } #end // if scale <0.62, 0.5, 0.61> rotate -y*clock translate y*1.05 } #end // macro // ------------------------------------------------------ ## #macro Chose () union { Chose_le_pied () Chose_le_corps () } #end // macro /* ======================================================= */ #declare Horloge = object { #local Texte = str(NormClock, 6, 3); #debug concat("Texte horloge ", Texte, "\n\n") text { // ttf "datas/DSEG7Classic-Regular.ttf" Texte 0.1, 0 ttf "datas/ComicMono-Bold.ttf" Texte 0.1, 0 texture { tPlasticGreen } } scale 3.00 rotate 90*x translate <-4.5, 0.044, 0> } // ======================================================= /* * need more work ! */ #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 scale 0.666 } #end // macro // ------------------------------------------------------ ## #macro HexaPole_tubes () #local R = 0.04; #local E = 0.58; #local H = H_cone*1.5; union { #for (A, 0, 359, 60) #local Xp = E * cos(radians(A)); #local Zp = E * sin(radians(A)); union { #local H2 = H + rand(Rng1) + rand(Rng1); cylinder { 0, y*H2, R } sphere { 0, R*2 scale <1, 0.555, 1> } sphere { 0, R*2 scale <1, 1.555, 1> translate y*H2 } #local Ra = rand(Rng1); #if (Ra < 0.25) texture { T_Chrome_1A } #elseif (Ra < 0.50) texture { T_Chrome_4D } #elseif (Ra < 0.75) texture { T_Brass_2C } #else texture { Soft_Silver } #end translate } #end } #undef E #undef H #undef R #end // ------------------------------------------------------ ## /* * l'assemblage en grand cercle de ces trucs est * dans le fichier "contexte.inc" */ #macro HexaPole () union { object { Base_hexapole () scale <0.24, 0.2, 0.24> } object { HexaPole_tubes () translate y*0.15 } rotate y*(53*rand(Rng1)) } #end // macro // ======================================================= #macro OpenBox (D, R) union { /* les verticales */ cylinder { <-D, -D, -D>, <-D, D, -D>, R } cylinder { < D, -D, -D>, < D, D, -D>, R } cylinder { <-D, -D, D>, <-D, D, D>, R } cylinder { < D, -D, D>, < D, D, D>, R } /* en bas */ cylinder { < D, -D, D>, <-D, -D, D>, R } cylinder { < D, -D, -D>, <-D, -D, -D>, R } cylinder { <-D, -D, D>, <-D, -D, -D>, R } cylinder { < D, -D, D>, < D, -D, -D>, R } /* en haut */ cylinder { < D, D, D>, <-D, D, D>, R } cylinder { < D, D, -D>, <-D, D, -D>, R } cylinder { <-D, D, D>, <-D, D, -D>, R } cylinder { < D, D, D>, < D, D, -D>, R } texture { Soft_Silver scale 6.50 } } #end // ======================================================= /* * 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 } } // =======================================================