%% syntaxe : solid r newgeode --> solid
%% syntaxe : N r newgeode --> solid
%% N in {3,4,5} -> polyhedre de depart, r = niveau de recursion
/newgeode {
2 dict begin
/r exch def
dup issolid not {
/N exch def
N 3 eq {
1 newtetraedre
} {
N 4 eq {
1 newoctaedre
} {
1 newicosaedre
} ifelse
} ifelse
} if
r {
15 dict begin
/solid exch def
solid dupsolid /result exch def pop
/n solid solidnombrefaces def
n 1 sub -1 0 {
/i exch def
%% la face d indice i
solid i solidgetface /F exch def
/i0 F 0 get def
/i1 F 1 get def
/i2 F 2 get def
solid i0 solidgetsommet /A0 defpoint3d
solid i1 solidgetsommet /A1 defpoint3d
solid i2 solidgetsommet /A2 defpoint3d
A0 A1 milieu3d normalize3d /A01 defpoint3d
A1 A2 milieu3d normalize3d /A12 defpoint3d
A2 A0 milieu3d normalize3d /A20 defpoint3d
result A01 solidaddsommet /i01 exch def
result A12 solidaddsommet /i12 exch def
result A20 solidaddsommet /i20 exch def
result i solidrmface
result [i0 i01 i20] solidaddface
result [i01 i1 i12] solidaddface
result [i01 i12 i20] solidaddface
result [i20 i12 i2] solidaddface
} for
result
end
} repeat
end
} def
%% syntaxe : N r newdualgeode --> solid
/newdualgeode {
newgeode 1
dualpolyedreregulier
} def
|