%% syntaxe : z0 r0 z1 newcylindre -> solide
%% syntaxe : z0 r0 z1 {mode} newcylindre -> solide
%% syntaxe : z0 r0 z1 [n1 n2] newcylindre -> solide
%% syntaxe : a b {f} {u} h [n1 n2] newcylindre
/newcylindre {
2 dict begin
[[/n2 /n1] [1 6] [1 8] [1 10] [3 12] [5 18]] gestionsolidmode
2 copy pop xcheck {
%% cylindre cas general
/h exch def
/U exch def
U normalize3d /u defpoint3d
/lafonction exch def
/b exch def
/a exch def
/pas b a sub n1 div def
/vpas h n2 div def
/S [
0 1 n2 {
/j exch def
0 1 n1 {
/i exch def
a i pas mul add lafonction
u j vpas mul mulv3d addv3d
} for
} for
] def
/F [
0 1 n2 1 sub {
/j exch def
0 1 n1 1 sub {
/i exch def
[
i n1 1 add j mul add
dup 1 add
dup n1 1 add add
dup 1 sub
]
} for
} for
] def
S F generesolid
% dup videsolid
} {
%% cylindre de revolution
2 copy pop [n2 n1] newtronccone
} ifelse
end
} def
%% syntaxe : z0 r0 z1 newcylindrecreux -> solide
/newcylindrecreux {
newcylindre
dup creusesolid
} def
|