HexaCone/xperiment.inc
2026-02-14 13:35:54 +01:00

296 lines
7.4 KiB
PHP

/*
* H E X A C O N E - X P E R I M E N T
*
* A cosy place for experimental things (2025/10/27)
*
*/
/* =============================================================== */
/*
* nouveau : Tue Feb 10 12:42:43 AM UTC 2026
*/
#macro HoleBorder_A (V)
difference {
#local RA = V * R_hole * 1.004;
#local RB = V * R_hole * 0.996;
#local HB_H = 0.53;
cylinder { 0, y*HB_H, RA }
cylinder { -y, y*2, RB }
#for (foo, 0, 179, 4)
cylinder {
<-20, 0, 0>, < 20, 0, 0>, 0.075
scale <1, 2.2, 1> translate y*(HB_H/2)
rotate y*foo
}
#end // for
#local R = rand(Rng1);
#if (R < 0.42) texture { LeGris }
#else texture { T_Beton_1 }
#end
}
#end
/* --------------------------------------------------------------- */
#macro HoleBorder_B (V)
union {
#local Ra = V * R_hole * 1.02;
#local Rb = 0.028;
#local KY = 0.21;
torus { Ra, Rb texture { T_Beton_2 } translate y*KY }
torus { Ra, Rb texture { T_WIP_color } translate y*(KY*2) }
torus { Ra, Rb texture { T_WIP_dents } translate y*(KY*3) }
#for (foo, 0, 359.99, 15)
#local Dx = Ra * sin(radians(foo));
#local Dz = Ra * cos(radians(foo));
cylinder { 0, y*(3.2*KY), Rb*0.72
#local R = rand(Rng1);
#if (R < 0.67) texture { tPlasticPrune }
#else texture { tPlasticGreen }
#end // if R
translate <Dx, 0, Dz>
}
#end // for
}
#end
/* =============================================================== */
/*
* new Tue Dec 30 07:39:09 AM UTC 2025
*/
#declare Patrouille = object
{
union {
#local EX = 1.9;
#local EZ = 2.0 + (0.5*sin(NormClock*2));
object { Trident_A () rotate x*87 }
object { HexaBenz () translate <-EX, 0, -EZ> }
object { HexaCone () translate < EX, -0.4, -EZ> }
object { HexaStar rotate y*90 translate <-EX*2, 0, -EZ*2> }
object { HexaCone () translate < EX*2, 0.3, -EZ*2> }
}
rotate y*90 // pour pointer vers X
}
/* =============================================================== */
#macro Pointe_Wagonnet_0 ()
merge {
cone { 0, 0.06, y*0.33, 0.001 }
sphere { 0, 0.06 }
#local R = rand(Rng1);
#if (R < 0.25)
texture { T_Chrome_3A }
#elseif (R < 0.50)
texture { T_Chrome_2B }
#elseif (R < 0.75)
texture { T_Chrome_3C }
#else
texture { T_Chrome_3D }
#end // IF
}
#end // Macro
/* --------------------------------------------------------------- */
#macro Corps_Wagonnet_0 (Longueur)
object {
/* le corps */
merge {
#local L2 = Longueur / 2;
#local R = 0.29;
cylinder { <L2, 0, 0>, <-L2, 0, 0>, R }
sphere { <0, 0, 0>, R
scale <3, 1, 1>
translate x*L2
}
sphere { <-L2, 0, 0>, R }
/* le kiosque (est-ce un sous-marin ?) */
merge {
#local H2 = L2 * 0.50;
cylinder { <0, 0, 0>, <0, H2, 0>, R/4 }
sphere { <0, 0, 0>, R/4
scale <1, 0.5, 1> translate y*H2
}
scale <2.5, 1, 1> translate x*L2*0.75
}
#local R = rand(Rng1);
#if (R < 0.27) texture { T_Brass_2C }
#elseif (R < 0.56) texture { GoldDark }
#elseif (R < 0.70) texture { T_Chrome_5A }
#else texture { T_Gold_3C }
#end
}
}
#end // macro
/* --------------------------------------------------------------- */
#macro Wagonnet_0 (Longueur)
union {
object { Corps_Wagonnet_0 (Longueur) }
#for (Foo, 0, 5)
#local DX = 0.35 - (Foo*0.24);
#local RP = -30 + (60 * rand(Rng1));
object { Pointe_Wagonnet_0 ()
translate <DX, 0.31, 0> rotate x*RP }
#end
// object { Repere scale 0.75 translate <0.06, 0.55, 0.25> }
}
#end // macro
/* =============================================================== */
/* nouveau du 7 octobre 2025 */
#macro Une_Boule ()
sphere {
0, 0.18 + (rand(Rng1) * 0.06)
#local R = rand(Rng1);
#if (R < 0.333) texture { C_Texture }
#elseif (R < 0.666) texture { M_Texture }
#else texture { Y_Texture }
#end
finish { phong 0.7 specular 0.3 }
}
#end // macro
/* TODO
* trouver une meilleure méthode de placement
*/
#declare Les_Boules = object
{
union {
#for (A, 0, 64, 1)
#local CK = (NormClock*55.00) + (A*0.28);
object { Une_Boule ()
#local TX = 3.2 * sin(CK);
#local TY = 0.4 * cos(sin(CK));
#local TZ = 3.0 * cos(1-CK);
translate <TX, TY, TZ>
}
object { Repere scale 2 }
#end // for
}
}
/* =============================================================== */
/*
* nouveau du 25 octobre 2025
*/
#macro Une_Arche (Val)
object {
// #debug concat(" Arche, val = ", str(Val, 6, 4), "\n")
merge {
#local Ha = 1.80;
#local D2 = Val * 1.414;
// mettre une base de la colonne
cylinder { <-1, 0, 0>, <-1, 0.20, 0> D2 }
cylinder { < 1, 0, 0>, < 1, 0.20, 0> D2 }
sphere { 0, D2 scale <1, 0.5, 1> translate <-1, 0.20, 0> }
sphere { 0, D2 scale <1, 0.5, 1> translate < 1, 0.20, 0> }
// les deux futs de l'arche
cylinder { <-1, 0, 0>, <-1, Ha, 0>, Val }
cylinder { < 1, 0, 0>, < 1, Ha, 0>, Val }
#if (rand(Rng1) < 0.50)
torus { 0.008, Val*1.08 translate <-1, Ha, 0> }
torus { 0.008, Val*1.08 translate < 1, Ha, 0> }
#else
cylinder { y*(Ha-0.07), y*(Ha+0.01), Val*1.12 translate -x }
cylinder { y*(Ha-0.08), y*(Ha+0.01), Val*1.13 translate x }
#end
intersection {
torus { 1, Val }
box { <-20, -5, 0>, <20, 5, -20> }
rotate <90, 0, 0> translate Ha*y
}
#local R = rand(Rng1);
#if (R < 0.20) texture { T_Stone40 scale 5+rand(Rng1) }
#elseif (R < 0.40) texture { T_Stone44 scale 4+rand(Rng1) }
#elseif (R < 0.60) texture { T_Stone32 scale 6+3*rand(Rng1) }
#elseif (R < 0.80) texture { T_Stone24 scale 5+rand(Rng1) }
#else texture { T_Stone36 scale 3+rand(Rng1) }
#end
}
}
#end
#macro Les_Arches (EK)
union {
#local E = EK + (rand(Rng1) * 0.50);
object { Une_Arche (0.20) }
object { Une_Arche (0.16) translate -z*E }
object { Une_Arche (0.16) translate z*E }
object { Une_Arche (0.12) translate -z*E*2 }
object { Une_Arche (0.12) translate z*E*2 }
object { Une_Arche (0.08) translate -z*E*3 }
object { Une_Arche (0.08) translate z*E*3 }
}
#end // macro
#macro Trois_Arches (Dist)
union {
object { Une_Arche (0.05) }
object { Une_Arche (0.05) translate z*2 }
object { Une_Arche (0.05) translate z*4 }
scale 1.85
}
#end // macro trois arches
// ==============================================================
/*
* new Mon Oct 27 04:54:41 PM UTC 2025
*/
#macro Un_Pylone (Type, Hauteur)
#debug " Un pylone ?\n"
#end // macro
// ==============================================================
/*
* nouveau du 12 octobre 2025
*/
#macro Cahute_0 ()
difference {
#local KX = 0.52;
#local KH = 1.80 + rand(Rng1) ;
// #debug concat(" Cahute_0, KH = ", str(KH, 6, 4), "\n")
#local KZ = KX + (0.24*rand(Rng1));
box { <-KX, 0, -KZ>, <KX, KH, KZ> }
#local Mult = 0.97;
#local KX = KX * Mult;
#local KH = KH * Mult;
#local KZ = KZ * Mult;
box { <-KX, 0.0001, -KZ>, <KX, KH, KZ> }
cylinder { <-10, KH*0.70, 0>, <10, KH*0.72, 0>, KX * 0.823 }
#local R = rand(Rng1);
// #debug concat("Random = ", str(R, 6, 4), "\n")
#if ( R < 0.23 ) texture { T_Planete_A }
#elseif ( R < 0.56 ) texture { T_Beton_1 }
#else texture { T_Beton_2 }
#end // if
rotate y * (207 * rand(Rng1))
}
#end // macro
/* le support des cahutes XXX */
#macro Les_Cahutes ()
union {
#local H = 0.80;
#local K = 2.75;
union {
object { Cahute_0 () translate -x * K }
object { Cahute_0 () translate x * K }
object { Cahute_0 () translate -z * K }
object { Cahute_0 () translate z * K }
translate y*H
}
#local K2 = K + 1.35;
box { <-K2, 0, -K2>, <K2, H, K2> pigment { Gray30 } }
}
scale 0.5
// rotate -y * (clock*0.33)
#end
// =======================================================