/tub@dernierk1 [1 0 0] def
/tub@dernierk2 [0 1 0] def
/tub@dernierk3 [0 0 1] def
/inittube {
2 dict begin
normalize3d /vect3 defpoint3d
normalize3d /vect2 defpoint3d
normalize3d /vect1 defpoint3d
vect1 norme3d 0 eq {
vect2 vect3 vectprod3d /vect1 defpoint3d
} if
vect2 norme3d 0 eq {
vect3 vect1 vectprod3d /vect2 defpoint3d
} if
vect3 norme3d 0 eq {
vect1 vect2 vectprod3d /vect3 defpoint3d
} if
/tub@dernierk1 [vect1] store
/tub@dernierk2 [vect2] store
/tub@dernierk3 [vect3] store
end
} def
%% syntaxe : tmin tmax (f) array r newtube -> solid
%% array = [K N]
/newtube {
10 dict begin
/table exch def
/K table 0 get def %% nb d etages
/N table 1 get def %% nb de points sur le perimetre
/@r exch def %% le rayon du tube
/str exch def
/lafonction str cvx def
/laderivee str (') append cvx def
%% /laderivee2nd str ('') append cvx def
/tmax exch def
/tmin exch def
/pas tmax tmin sub K 1 sub div def
%% definition des sommets
[
/@k 0 def
K {
/a0 tmin @k pas mul add def
%% definition du repere de Frenet (k1, k2, k3) au point f(a)
a0 lafonction /M defpoint3d
str (') append cvlit where {
pop
a0 laderivee normalize3d /k1 defpoint3d
% pop /avecderiv true def
} {
M a0 pas 100 div add lafonction vecteur3d normalize3d /k1 defpoint3d
% /avecderiv false
} ifelse
k1 baseplannormal /K3 defpoint3d /K2 defpoint3d
% a0 laderivee2nd normalize3d /k2 defpoint3d
%% projete orthogonal du dernier rayon sur le plan actuel
%% (normal a la vitesse)
K2 tub@dernierk2 aload pop K2 scalprod3d mulv3d
K3 tub@dernierk2 aload pop K3 scalprod3d mulv3d addv3d /k2 defpoint3d
% M k1 K2 K3 dessinebase
k1 norme3d 0 eq {
tub@dernierk1 aload pop /k1 defpoint3d
} {
/tub@dernierk1 [k1] store
} ifelse
k2 norme3d 0 eq {
tub@dernierk2 aload pop /k2 defpoint3d
} {
/tub@dernierk2 [k2] store
} ifelse
k1 k2 vectprod3d normalize3d /k3 defpoint3d
k3 norme3d 0 eq {
tub@dernierk3 aload pop /k3 defpoint3d
} {
/tub@dernierk3 [k3] store
} ifelse
k3 k1 vectprod3d normalize3d /k2 defpoint3d
%% M k1 k2 k3 dessinebase
/tub@dernierk2 [k2] store
/@n 360 N div def %% le pas angulaire
0 @n 360 @n sub {
/@i exch def
M
k2 @i cos @r mul mulv3d addv3d
k3 @i sin @r mul mulv3d addv3d
} for
/@k @k 1 add store
} repeat
]
dup length 3 idiv /nb exch def
%% definition des faces
[
%% face de depart
[N 1 sub -1 0 {} for]
%% face d arrivee
[nb 1 sub N 1 sub {dup 1 sub} repeat] reverse
%% les etages
/j 0 def
K 1 sub {
0 1 N 1 sub {
/i exch def
[
i N j mul add
i 1 add N mod N j mul add
i 1 add N mod N add N j mul add
i N add N j mul add
]
} for
/j j 1 add store
} repeat
]
generesolid
end
} def
%% %% syntaxe : tmin tmax (f) array r newtube -> solid
%% %% array = [K N]
%% /newtube {
%% 10 dict begin
%% /table exch def
%% /K table 0 get def %% nb d etages
%% /N table 1 get def %% nb de points sur le perimetre
%% /@r exch def %% le rayon du tube
%% /str exch def
%% /lafonction str cvx def
%% /laderivee str (') append cvx def
%% /laderivee2nd str ('') append cvx def
%% /tmax exch def
%% /tmin exch def
%% /pas tmax tmin sub K 1 sub div def
%%
%% %% definition des sommets
%% [
%% /@k 0 def
%% K {
%% /a0 tmin @k pas mul add def
%%
%% %% definition du repere de Frenet (k1, k2, k3) au point f(a)
%% a0 lafonction /M defpoint3d
%% a0 laderivee normalize3d /k1 defpoint3d
%% % M a0 pas 10 div add lafonction vecteur3d normalize3d /k1 defpoint3d
%% k1 baseplannormal /K3 defpoint3d /K2 defpoint3d
%% % M k1 k2 K3 dessinebase
%% % a0 laderivee2nd normalize3d /k2 defpoint3d
%% K2 tub@dernierk2 aload pop K2 scalprod3d mulv3d
%% K3 tub@dernierk2 aload pop K3 scalprod3d mulv3d addv3d /k2 defpoint3d
%% k1 norme3d 0 eq {
%% tub@dernierk1 aload pop /k1 defpoint3d
%% } {
%% /tub@dernierk1 [k1] store
%% } ifelse
%% k2 norme3d 0 eq {
%% tub@dernierk2 aload pop /k2 defpoint3d
%% } {
%% /tub@dernierk2 [k2] store
%% } ifelse
%% k1 k2 vectprod3d normalize3d /k3 defpoint3d
%% k3 norme3d 0 eq {
%% (BINGO) ==
%% bou
%% tub@dernierk3 aload pop /k3 defpoint3d
%% } {
%% /tub@dernierk3 [k3] store
%% } ifelse
%% k3 k1 vectprod3d normalize3d /k2 defpoint3d
%% /tub@dernierk2 [k2] store
%% /@n 360 N div def %% le pas angulaire
%% 0 @n 360 @n sub {
%% /@i exch def
%% M
%% k2 @i cos @r mul mulv3d addv3d
%% k3 @i sin @r mul mulv3d addv3d
%% } for
%% /@k @k 1 add store
%% } repeat
%% ]
%%
%% dup length 3 idiv /nb exch def
%% %% definition des faces
%% [
%% %% face de depart
%% [N 1 sub -1 0 {} for]
%% %% face d arrivee
%% [nb 1 sub N 1 sub {dup 1 sub} repeat] reverse
%%
%% %% les etages
%% /j 0 def
%% K 1 sub {
%% 0 1 N 1 sub {
%% /i exch def
%% [
%% i N j mul add
%% i 1 add N mod N j mul add
%% i 1 add N mod N add N j mul add
%% i N add N j mul add
%% ]
%% } for
%% /j j 1 add store
%% } repeat
%% ]
%% generesolid
%% end
%% } def
%% %% syntaxe : tmin tmax (f) array r newtube -> solid
%% %% array = [K N]
%% /newtube {
%% 10 dict begin
%% /table exch def
%% /K table 0 get def %% nb d etages
%% /N table 1 get def %% nb de points sur le perimetre
%% /@r exch def %% le rayon du tube
%% /str exch def
%% /lafonction str cvx def
%% /laderivee str (') append cvx def
%% /laderivee2nd str ('') append cvx def
%% /tmax exch def
%% /tmin exch def
%% /pas tmax tmin sub K 1 sub div def
%%
%% %% definition des sommets
%% [
%% /@k 0 def
%% K {
%% /a0 tmin @k pas mul add def
%%
%% %% definition du repere de Frenet (k1, k2, k3) au point f(a)
%% a0 lafonction /M defpoint3d
%% a0 laderivee normalize3d /k1 defpoint3d
%% a0 laderivee2nd normalize3d /k2 defpoint3d
%% k1 norme3d 0 eq {
%% tub@dernierk1 aload pop /k1 defpoint3d
%% } {
%% /tub@dernierk1 [k1] store
%% } ifelse
%% k2 norme3d 0 eq {
%% tub@dernierk2 aload pop /k2 defpoint3d
%% } {
%% /tub@dernierk2 [k2] store
%% } ifelse
%% k1 k2 vectprod3d normalize3d /k3 defpoint3d
%% k3 norme3d 0 eq {
%% tub@dernierk3 aload pop /k3 defpoint3d
%% } {
%% /tub@dernierk3 [k3] store
%% } ifelse
%% k3 k1 vectprod3d normalize3d /k2 defpoint3d
%% /tub@dernierk2 [k2] store
%% /@n 360 N div def %% le pas angulaire
%% 0 @n 360 @n sub {
%% /@i exch def
%% M
%% k2 @i cos @r mul mulv3d addv3d
%% k3 @i sin @r mul mulv3d addv3d
%% } for
%% /@k @k 1 add store
%% } repeat
%% ]
%%
%% dup length 3 idiv /nb exch def
%% %% definition des faces
%% [
%% %% face de depart
%% [N 1 sub -1 0 {} for]
%% %% face d arrivee
%% [nb 1 sub N 1 sub {dup 1 sub} repeat] reverse
%%
%% %% les etages
%% /j 0 def
%% K 1 sub {
%% 0 1 N 1 sub {
%% /i exch def
%% [
%% i N j mul add
%% i 1 add N mod N j mul add
%% i 1 add N mod N add N j mul add
%% i N add N j mul add
%% ]
%% } for
%% /j j 1 add store
%% } repeat
%% ]
%% generesolid
%% end
%% } def
%% 10/03/2008 %% %% syntaxe : tmin tmax (f) array r newtube -> solid
%% 10/03/2008 %% %% array = [K N]
%% 10/03/2008 %% /newtube {
%% 10/03/2008 %% 10 dict begin
%% 10/03/2008 %% /table exch def
%% 10/03/2008 %% /K table 0 get def %% nb d etages
%% 10/03/2008 %% /N table 1 get def %% nb de points sur le perimetre
%% 10/03/2008 %% /@r exch def %% le rayon du tube
%% 10/03/2008 %% /str exch def
%% 10/03/2008 %% /lafonction str cvx def
%% 10/03/2008 %% /laderivee str (') append cvx def
%% 10/03/2008 %% /laderivee2nd str ('') append cvx def
%% 10/03/2008 %% /tmax exch def
%% 10/03/2008 %% /tmin exch def
%% 10/03/2008 %% /pas tmax tmin sub K 1 sub div def
%% 10/03/2008 %%
%% 10/03/2008 %% %% definition des sommets
%% 10/03/2008 %% [
%% 10/03/2008 %% tmin pas tmax {
%% 10/03/2008 %% /a0 exch def
%% 10/03/2008 %%
%% 10/03/2008 %% %% definition du repere de Frenet (k1, k2, k3) au point f(a)
%% 10/03/2008 %% a0 lafonction /M defpoint3d
%% 10/03/2008 %% a0 laderivee normalize3d /k1 defpoint3d
%% 10/03/2008 %% a0 laderivee2nd normalize3d /k2 defpoint3d
%% 10/03/2008 %% k1 norme3d 0 eq {
%% 10/03/2008 %% tub@dernierk1 aload pop /k1 defpoint3d
%% 10/03/2008 %% } {
%% 10/03/2008 %% /tub@dernierk1 [k1] store
%% 10/03/2008 %% } ifelse
%% 10/03/2008 %% k2 norme3d 0 eq {
%% 10/03/2008 %% tub@dernierk2 aload pop /k2 defpoint3d
%% 10/03/2008 %% } {
%% 10/03/2008 %% /tub@dernierk2 [k2] store
%% 10/03/2008 %% } ifelse
%% 10/03/2008 %% k1 k2 vectprod3d normalize3d /k3 defpoint3d
%% 10/03/2008 %% k3 norme3d 0 eq {
%% 10/03/2008 %% tub@dernierk3 aload pop /k3 defpoint3d
%% 10/03/2008 %% } {
%% 10/03/2008 %% /tub@dernierk3 [k3] store
%% 10/03/2008 %% } ifelse
%% 10/03/2008 %% k3 k1 vectprod3d normalize3d /k2 defpoint3d
%% 10/03/2008 %% /tub@dernierk2 [k2] store
%% 10/03/2008 %% /@n 360 N div def %% le pas angulaire
%% 10/03/2008 %% 0 @n 360 @n sub {
%% 10/03/2008 %% /@i exch def
%% 10/03/2008 %% M
%% 10/03/2008 %% k2 @i cos @r mul mulv3d addv3d
%% 10/03/2008 %% k3 @i sin @r mul mulv3d addv3d
%% 10/03/2008 %% } for
%% 10/03/2008 %% } for
%% 10/03/2008 %% ]
%% 10/03/2008 %%
%% 10/03/2008 %% dup length 3 idiv /nb exch def
%% 10/03/2008 %% %% definition des faces
%% 10/03/2008 %% [
%% 10/03/2008 %% %% face de depart
%% 10/03/2008 %% [N 1 sub -1 0 {} for]
%% 10/03/2008 %% %% face d arrivee
%% 10/03/2008 %% [nb 1 sub N 1 sub {dup 1 sub} repeat] reverse
%% 10/03/2008 %%
%% 10/03/2008 %% %% les etages
%% 10/03/2008 %% /j 0 def
%% 10/03/2008 %% tmin pas tmax pas sub {
%% 10/03/2008 %% pop
%% 10/03/2008 %% 0 1 N 1 sub {
%% 10/03/2008 %% /i exch def
%% 10/03/2008 %% [
%% 10/03/2008 %% i N j mul add
%% 10/03/2008 %% i 1 add N mod N j mul add
%% 10/03/2008 %% i 1 add N mod N add N j mul add
%% 10/03/2008 %% i N add N j mul add
%% 10/03/2008 %% ]
%% 10/03/2008 %% } for
%% 10/03/2008 %% /j j 1 add store
%% 10/03/2008 %% } for
%% 10/03/2008 %% ]
%% 10/03/2008 %% generesolid
%% 10/03/2008 %% end
%% 10/03/2008 %% } def
%% /tub@dernierk1 [1 0 0] def
%% /tub@dernierk2 [0 1 0] def
%% /tub@dernierk3 [0 0 1] def
%%
%% /inittube {
%% 2 dict begin
%% normalize3d /vect3 defpoint3d
%% normalize3d /vect2 defpoint3d
%% normalize3d /vect1 defpoint3d
%% vect1 norme3d 0 eq {
%% vect2 vect3 vectprod3d /vect1 defpoint3d
%% } if
%% vect2 norme3d 0 eq {
%% vect3 vect1 vectprod3d /vect2 defpoint3d
%% } if
%% vect3 norme3d 0 eq {
%% vect1 vect2 vectprod3d /vect3 defpoint3d
%% } if
%% /tub@dernierk1 [vect1] store
%% /tub@dernierk2 [vect2] store
%% /tub@dernierk3 [vect3] store
%% end
%% } def
%%
%% %% syntaxe : tmin tmax (f) array r newtube -> solid
%% %% array = [K N]
%% /newtube {
%% 10 dict begin
%% /table exch def
%% /K table 0 get def %% nb d etages
%% /N table 1 get def %% nb de points sur le perimetre
%% /@r exch def %% le rayon du tube
%% /str exch def
%% /lafonction str cvx def
%% /laderivee str (') append cvx def
%% /laderivee2nd str ('') append cvx def
%% /tmax exch def
%% /tmin exch def
%% /pas tmax tmin sub K 1 sub div def
%%
%% %% definition des sommets
%% [
%% tmin pas tmax {
%% /a0 exch def
%%
%% %% definition du repere de Frenet (k1, k2, k3) au point f(a)
%% a0 lafonction /M defpoint3d
%% a0 laderivee normalize3d /k1 defpoint3d
%% a0 laderivee2nd normalize3d /k2 defpoint3d
%% k1 norme3d 0 eq {
%% tub@dernierk1 aload pop /k1 defpoint3d
%% } {
%% /tub@dernierk1 [k1] store
%% } ifelse
%% k2 norme3d 0 eq {
%% tub@dernierk2 aload pop /k2 defpoint3d
%% } {
%% /tub@dernierk2 [k2] store
%% } ifelse
%% k1 k2 vectprod3d normalize3d /k3 defpoint3d
%% k3 norme3d 0 eq {
%% tub@dernierk3 aload pop /k3 defpoint3d
%% } {
%% /tub@dernierk3 [k3] store
%% } ifelse
%% /@n 360 N div def %% le pas angulaire
%% 0 @n 360 @n sub {
%% /@i exch def
%% M
%% k2 @i cos @r mul mulv3d addv3d
%% k3 @i sin @r mul mulv3d addv3d
%% } for
%% } for
%% ]
%%
%% dup length 3 idiv /nb exch def
%% %% definition des faces
%% [
%% %% face de depart
%% [N 1 sub -1 0 {} for]
%% %% face d arrivee
%% [nb 1 sub N 1 sub {dup 1 sub} repeat] reverse
%%
%% %% les etages
%% /j 0 def
%% tmin pas tmax pas sub {
%% pop
%% 0 1 N 1 sub {
%% /i exch def
%% [
%% i N j mul add
%% i 1 add N mod N j mul add
%% i 1 add N mod N add N j mul add
%% i N add N j mul add
%% ]
%% } for
%% /j j 1 add store
%% } for
%% ]
%% generesolid
%% end
%% } def
%% %% syntaxe : tmin tmax (f) array r newtube -> solid
%% %% array = [K N]
%% /newtube {
%% 10 dict begin
%% /table exch def
%% /K table 0 get def %% nb d etages
%% /N table 1 get def %% nb de points sur le perimetre
%% /@r exch def %% le rayon du tube
%% /str exch def
%% /lafonction str cvx def
%% /laderivee str (') append cvx def
%% /laderivee2nd str ('') append cvx def
%% /tmax exch def
%% /tmin exch def
%% /pas tmax tmin sub K 1 sub div def
%%
%% %% definition des sommets
%% [
%% tmin pas tmax {
%% /a0 exch def
%%
%% %% definition du repere de Frenet (k1, k2, k3) au point f(a)
%% a0 lafonction /M defpoint3d
%% a0 laderivee normalize3d /k1 defpoint3d
%% a0 laderivee2nd normalize3d /k2 defpoint3d
%% k1 k2 vectprod3d normalize3d /k3 defpoint3d
%%
%% /@n 360 N div def %% le pas angulaire
%% 0 @n 360 @n sub {
%% /i exch def
%% M
%% k2 i cos @r mul mulv3d addv3d
%% k3 i sin @r mul mulv3d addv3d
%% } for
%% } for
%% ]
%%
%% dup length 3 idiv /nb exch def
%% %% definition des faces
%% [
%% %% face de depart
%% [N 1 sub -1 0 {} for]
%% %% face d arrivee
%% [nb 1 sub N 1 sub {dup 1 sub} repeat] reverse
%%
%% %% les etages
%% /j 0 def
%% tmin pas tmax pas sub {
%% pop
%% 0 1 N 1 sub {
%% /i exch def
%% [
%% i N j mul add
%% i 1 add N mod N j mul add
%% i 1 add N mod N add N j mul add
%% i N add N j mul add
%% ]
%% } for
%% /j j 1 add store
%% } for
%% ]
%% generesolid
%% end
%% } def
|