%% syntaxe : M A u alpha rotatepoint3d --> M'
/rotatepoint3d {
10 dict begin
/alpha exch def
normalize3d /u defpoint3d
/A defpoint3d
/M defpoint3d
A M vecteur3d /AM defpoint3d
/x AM u scalprod3d def
AM
u x mulv3d
subv3d /AM' defpoint3d
/y AM' norme3d def
AM' normalize3d /v defpoint3d
u v vectprod3d /w defpoint3d
v alpha cos mulv3d
w alpha sin mulv3d addv3d
y mulv3d
u x mulv3d addv3d
A addv3d
%% %% dessin pour debug
%% y 1e-7 gt {
%% AM newvecteur
%% {A addv3d} solidtransform drawsolid
%% noir
%% u newvecteur
%% {A addv3d} solidtransform drawsolid
%% vert
%% v newvecteur
%% {A addv3d} solidtransform drawsolid
%% rouge
%% w newvecteur
%% {A addv3d} solidtransform drawsolid
%% 2 setlinewidth
%% [A v y mulv3d] ligne3d
%% [A u x mulv3d] ligne3d
%% } if
end
} def
%% syntaxe : v u alpha rotatev3d --> v
/rotatev3d {
10 dict begin
/alpha exch def
/u defpoint3d
0 0 0 u alpha rotatepoint3d
end
} def
|