| 1 |
%! |
|---|
| 2 |
% PostScript prologue for pst-solides3d.tex. |
|---|
| 3 |
% Version 4.10, 2008/08/31 |
|---|
| 4 |
% |
|---|
| 5 |
%% COPYRIGHT 2008 by Jean-Paul Vignault |
|---|
| 6 |
%% |
|---|
| 7 |
%% This program can be redistributed and/or modified under the terms |
|---|
| 8 |
%% of the LaTeX Project Public License Distributed from CTAN |
|---|
| 9 |
%% archives in directory macros/latex/base/lppl.txt. |
|---|
| 10 |
% |
|---|
| 11 |
/SolidesDict 100 dict def |
|---|
| 12 |
/SolidesbisDict 100 dict def |
|---|
| 13 |
SolidesDict begin |
|---|
| 14 |
|
|---|
| 15 |
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 16 |
%% %% les variables globales gerees par PSTricks %% |
|---|
| 17 |
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 18 |
%% %% les lignes dessous sont a decommenter si l on veut utiliser le |
|---|
| 19 |
%% %% fichier solides.pro independamment du package PSTricks |
|---|
| 20 |
%% /Dobs 20 def |
|---|
| 21 |
%% /THETA 20 def |
|---|
| 22 |
%% /PHI 50 def |
|---|
| 23 |
%% /Decran 30 def |
|---|
| 24 |
%% /XpointVue {Dobs Cos1Cos2 mul} def |
|---|
| 25 |
%% /YpointVue {Dobs Sin1Cos2 mul} def |
|---|
| 26 |
%% /ZpointVue {Dobs Sin2 mul} def |
|---|
| 27 |
%% /xunit 28.14 def |
|---|
| 28 |
%% /solidhollow false def |
|---|
| 29 |
%% /solidbiface false def |
|---|
| 30 |
%% /xunit 28.45 def |
|---|
| 31 |
%% /tracelignedeniveau? true def |
|---|
| 32 |
%% /hauteurlignedeniveau 1 def |
|---|
| 33 |
%% /couleurlignedeniveau {rouge} def |
|---|
| 34 |
%% /linewidthlignedeniveau 4 def |
|---|
| 35 |
%% /solidgrid true def |
|---|
| 36 |
/aretescachees true def |
|---|
| 37 |
/defaultsolidmode 2 def |
|---|
| 38 |
|
|---|
| 39 |
%% variables globales specifiques a PSTricks |
|---|
| 40 |
%% /activationgestioncouleurs true def |
|---|
| 41 |
/xmin -10 def |
|---|
| 42 |
/xmax 10 def |
|---|
| 43 |
/ymin -10 def |
|---|
| 44 |
/ymax 10 def |
|---|
| 45 |
|
|---|
| 46 |
/fillstyle {} def |
|---|
| 47 |
/startest false def |
|---|
| 48 |
/cm {} def |
|---|
| 49 |
/cm_1 {} def |
|---|
| 50 |
/yunit {xunit} def |
|---|
| 51 |
/angle_repere 90 def |
|---|
| 52 |
|
|---|
| 53 |
/hadjust 2.5 def |
|---|
| 54 |
/vadjust 2.5 def |
|---|
| 55 |
/pl@n-en-cours false def |
|---|
| 56 |
|
|---|
| 57 |
/pointilles { |
|---|
| 58 |
[6.25 3.75] 1.25 setdash |
|---|
| 59 |
} def |
|---|
| 60 |
/stockcurrentcpath {} def |
|---|
| 61 |
/newarrowpath {} def |
|---|
| 62 |
/chaine 15 string def |
|---|
| 63 |
|
|---|
| 64 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 65 |
%% choix d une fonte accentuee pour le .ps %% |
|---|
| 66 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 67 |
/ReEncode { exch findfont |
|---|
| 68 |
dup length dict begin { 1 index /FID eq {pop pop} {def} ifelse |
|---|
| 69 |
}forall /Encoding ISOLatin1Encoding def currentdict end definefont |
|---|
| 70 |
pop }bind def |
|---|
| 71 |
/Font /Times-Roman /ISOfont ReEncode /ISOfont def |
|---|
| 72 |
%Font findfont 10 scalefont setfont |
|---|
| 73 |
|
|---|
| 74 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 75 |
%% extrait de color.pro pour pouvoir recuperer ses couleurs %% |
|---|
| 76 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 77 |
/GreenYellow{0.15 0 0.69 0 setcmykcolor}def |
|---|
| 78 |
/Yellow{0 0 1 0 setcmykcolor}def |
|---|
| 79 |
/Goldenrod{0 0.10 0.84 0 setcmykcolor}def |
|---|
| 80 |
/Dandelion{0 0.29 0.84 0 setcmykcolor}def |
|---|
| 81 |
/Apricot{0 0.32 0.52 0 setcmykcolor}def |
|---|
| 82 |
/Peach{0 0.50 0.70 0 setcmykcolor}def |
|---|
| 83 |
/Melon{0 0.46 0.50 0 setcmykcolor}def |
|---|
| 84 |
/YellowOrange{0 0.42 1 0 setcmykcolor}def |
|---|
| 85 |
/Orange{0 0.61 0.87 0 setcmykcolor}def |
|---|
| 86 |
/BurntOrange{0 0.51 1 0 setcmykcolor}def |
|---|
| 87 |
/Bittersweet{0 0.75 1 0.24 setcmykcolor}def |
|---|
| 88 |
/RedOrange{0 0.77 0.87 0 setcmykcolor}def |
|---|
| 89 |
/Mahogany{0 0.85 0.87 0.35 setcmykcolor}def |
|---|
| 90 |
/Maroon{0 0.87 0.68 0.32 setcmykcolor}def |
|---|
| 91 |
/BrickRed{0 0.89 0.94 0.28 setcmykcolor}def |
|---|
| 92 |
/Red{0 1 1 0 setcmykcolor}def |
|---|
| 93 |
/OrangeRed{0 1 0.50 0 setcmykcolor}def |
|---|
| 94 |
/RubineRed{0 1 0.13 0 setcmykcolor}def |
|---|
| 95 |
/WildStrawberry{0 0.96 0.39 0 setcmykcolor}def |
|---|
| 96 |
/Salmon{0 0.53 0.38 0 setcmykcolor}def |
|---|
| 97 |
/CarnationPink{0 0.63 0 0 setcmykcolor}def |
|---|
| 98 |
/Magenta{0 1 0 0 setcmykcolor}def |
|---|
| 99 |
/VioletRed{0 0.81 0 0 setcmykcolor}def |
|---|
| 100 |
/Rhodamine{0 0.82 0 0 setcmykcolor}def |
|---|
| 101 |
/Mulberry{0.34 0.90 0 0.02 setcmykcolor}def |
|---|
| 102 |
/RedViolet{0.07 0.90 0 0.34 setcmykcolor}def |
|---|
| 103 |
/Fuchsia{0.47 0.91 0 0.08 setcmykcolor}def |
|---|
| 104 |
/Lavender{0 0.48 0 0 setcmykcolor}def |
|---|
| 105 |
/Thistle{0.12 0.59 0 0 setcmykcolor}def |
|---|
| 106 |
/Orchid{0.32 0.64 0 0 setcmykcolor}def |
|---|
| 107 |
/DarkOrchid{0.40 0.80 0.20 0 setcmykcolor}def |
|---|
| 108 |
/Purple{0.45 0.86 0 0 setcmykcolor}def |
|---|
| 109 |
/Plum{0.50 1 0 0 setcmykcolor}def |
|---|
| 110 |
/Violet{0.79 0.88 0 0 setcmykcolor}def |
|---|
| 111 |
/RoyalPurple{0.75 0.90 0 0 setcmykcolor}def |
|---|
| 112 |
/BlueViolet{0.86 0.91 0 0.04 setcmykcolor}def |
|---|
| 113 |
/Periwinkle{0.57 0.55 0 0 setcmykcolor}def |
|---|
| 114 |
/CadetBlue{0.62 0.57 0.23 0 setcmykcolor}def |
|---|
| 115 |
/CornflowerBlue{0.65 0.13 0 0 setcmykcolor}def |
|---|
| 116 |
/MidnightBlue{0.98 0.13 0 0.43 setcmykcolor}def |
|---|
| 117 |
/NavyBlue{0.94 0.54 0 0 setcmykcolor}def |
|---|
| 118 |
/RoyalBlue{1 0.50 0 0 setcmykcolor}def |
|---|
| 119 |
/Blue{1 1 0 0 setcmykcolor}def |
|---|
| 120 |
/Cerulean{0.94 0.11 0 0 setcmykcolor}def |
|---|
| 121 |
/Cyan{1 0 0 0 setcmykcolor}def |
|---|
| 122 |
/ProcessBlue{0.96 0 0 0 setcmykcolor}def |
|---|
| 123 |
/SkyBlue{0.62 0 0.12 0 setcmykcolor}def |
|---|
| 124 |
/Turquoise{0.85 0 0.20 0 setcmykcolor}def |
|---|
| 125 |
/TealBlue{0.86 0 0.34 0.02 setcmykcolor}def |
|---|
| 126 |
/Aquamarine{0.82 0 0.30 0 setcmykcolor}def |
|---|
| 127 |
/BlueGreen{0.85 0 0.33 0 setcmykcolor}def |
|---|
| 128 |
/Emerald{1 0 0.50 0 setcmykcolor}def |
|---|
| 129 |
/JungleGreen{0.99 0 0.52 0 setcmykcolor}def |
|---|
| 130 |
/SeaGreen{0.69 0 0.50 0 setcmykcolor}def |
|---|
| 131 |
/Green{1 0 1 0 setcmykcolor}def |
|---|
| 132 |
/ForestGreen{0.91 0 0.88 0.12 setcmykcolor}def |
|---|
| 133 |
/PineGreen{0.92 0 0.59 0.25 setcmykcolor}def |
|---|
| 134 |
/LimeGreen{0.50 0 1 0 setcmykcolor}def |
|---|
| 135 |
/YellowGreen{0.44 0 0.74 0 setcmykcolor}def |
|---|
| 136 |
/SpringGreen{0.26 0 0.76 0 setcmykcolor}def |
|---|
| 137 |
/OliveGreen{0.64 0 0.95 0.40 setcmykcolor}def |
|---|
| 138 |
/RawSienna{0 0.72 1 0.45 setcmykcolor}def |
|---|
| 139 |
/Sepia{0 0.83 1 0.70 setcmykcolor}def |
|---|
| 140 |
/Brown{0 0.81 1 0.60 setcmykcolor}def |
|---|
| 141 |
/Tan{0.14 0.42 0.56 0 setcmykcolor}def |
|---|
| 142 |
/Gray{0 0 0 0.50 setcmykcolor}def |
|---|
| 143 |
/Black{0 0 0 1 setcmykcolor}def |
|---|
| 144 |
/White{0 0 0 0 setcmykcolor}def |
|---|
| 145 |
%% fin de l extrait color.pro |
|---|
| 146 |
|
|---|
| 147 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 148 |
%%%% autres couleurs %%%% |
|---|
| 149 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 150 |
|
|---|
| 151 |
/bleu {0 0 1 setrgbcolor} def |
|---|
| 152 |
/rouge {1 0 0 setrgbcolor} def |
|---|
| 153 |
/vert {0 .5 0 setrgbcolor} def |
|---|
| 154 |
/gris {.4 .4 .4 setrgbcolor} def |
|---|
| 155 |
/jaune {1 1 0 setrgbcolor} def |
|---|
| 156 |
/noir {0 0 0 setrgbcolor} def |
|---|
| 157 |
/blanc {1 1 1 setrgbcolor} def |
|---|
| 158 |
/orange {1 .65 0 setrgbcolor} def |
|---|
| 159 |
/rose {1 .01 .58 setrgbcolor} def |
|---|
| 160 |
/cyan {1 0 0 0 setcmykcolor} def |
|---|
| 161 |
/magenta {0 1 0 0 setcmykcolor} def |
|---|
| 162 |
|
|---|
| 163 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 164 |
%%%% definition du point de vue %%%% |
|---|
| 165 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 166 |
%% pour la 3D conventionnelle |
|---|
| 167 |
%% Dony : graphisme scientifique : page 187 |
|---|
| 168 |
%% Editeur : Masson |
|---|
| 169 |
|
|---|
| 170 |
%% calcul des coefficients de la matrice |
|---|
| 171 |
%% de transformation |
|---|
| 172 |
/Sin1 {THETA sin} def |
|---|
| 173 |
/Sin2 {PHI sin} def |
|---|
| 174 |
/Cos1 {THETA cos} def |
|---|
| 175 |
/Cos2 {PHI cos} def |
|---|
| 176 |
/Cos1Sin2 {Cos1 Sin2 mul} def |
|---|
| 177 |
/Sin1Sin2 {Sin1 Sin2 mul} def |
|---|
| 178 |
/Cos1Cos2 {Cos1 Cos2 mul} def |
|---|
| 179 |
/Sin1Cos2 {Sin1 Cos2 mul} def |
|---|
| 180 |
|
|---|
| 181 |
/3dto2d { |
|---|
| 182 |
6 dict begin |
|---|
| 183 |
/Zcote exch def |
|---|
| 184 |
/Yordonnee exch def |
|---|
| 185 |
/Xabscisse exch def |
|---|
| 186 |
/xObservateur |
|---|
| 187 |
Xabscisse Sin1 mul neg Yordonnee Cos1 mul add |
|---|
| 188 |
def |
|---|
| 189 |
/yObservateur |
|---|
| 190 |
Xabscisse Cos1Sin2 mul neg Yordonnee Sin1Sin2 mul sub Zcote Cos2 |
|---|
| 191 |
mul add |
|---|
| 192 |
def |
|---|
| 193 |
/zObservateur |
|---|
| 194 |
Xabscisse neg Cos1Cos2 mul Yordonnee Sin1Cos2 mul sub Zcote Sin2 |
|---|
| 195 |
mul sub Dobs add |
|---|
| 196 |
def |
|---|
| 197 |
%% maintenant on depose les resultats sur la pile |
|---|
| 198 |
Decran xObservateur mul zObservateur div cm |
|---|
| 199 |
Decran yObservateur mul zObservateur div cm |
|---|
| 200 |
end |
|---|
| 201 |
} def |
|---|
| 202 |
|
|---|
| 203 |
/getpointVue { |
|---|
| 204 |
XpointVue |
|---|
| 205 |
YpointVue |
|---|
| 206 |
ZpointVue |
|---|
| 207 |
} def |
|---|
| 208 |
|
|---|
| 209 |
/GetCamPos { |
|---|
| 210 |
getpointVue |
|---|
| 211 |
} def |
|---|
| 212 |
|
|---|
| 213 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 214 |
%%%% jps modifie pour PSTricks %%%% |
|---|
| 215 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 216 |
|
|---|
| 217 |
/solid {continu} def |
|---|
| 218 |
/dashed {pointilles} def |
|---|
| 219 |
|
|---|
| 220 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 221 |
%%%% geometrie basique %%%% |
|---|
| 222 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 223 |
|
|---|
| 224 |
%% syntaxe~: [x1 y1 ... xn yn] ligne |
|---|
| 225 |
/ligne { |
|---|
| 226 |
gsave |
|---|
| 227 |
newpath |
|---|
| 228 |
dup 0 getp smoveto |
|---|
| 229 |
ligne_ |
|---|
| 230 |
starfill |
|---|
| 231 |
stroke |
|---|
| 232 |
grestore |
|---|
| 233 |
} def |
|---|
| 234 |
|
|---|
| 235 |
%% syntaxe~: [x1 y1 ... xn yn] ligne_ |
|---|
| 236 |
/ligne_ { |
|---|
| 237 |
reversep |
|---|
| 238 |
aload length 2 idiv |
|---|
| 239 |
{ |
|---|
| 240 |
slineto |
|---|
| 241 |
} repeat |
|---|
| 242 |
} def |
|---|
| 243 |
|
|---|
| 244 |
%% syntaxe~: [x1 y1 ... xn yn] polygone |
|---|
| 245 |
/polygone* { |
|---|
| 246 |
1 dict begin |
|---|
| 247 |
/startest {true} def |
|---|
| 248 |
polygone |
|---|
| 249 |
end |
|---|
| 250 |
} def |
|---|
| 251 |
|
|---|
| 252 |
/polygone_ { |
|---|
| 253 |
newpath |
|---|
| 254 |
aload length 2 idiv |
|---|
| 255 |
3 copy pop |
|---|
| 256 |
smoveto |
|---|
| 257 |
{ |
|---|
| 258 |
slineto |
|---|
| 259 |
} repeat |
|---|
| 260 |
closepath |
|---|
| 261 |
} def |
|---|
| 262 |
|
|---|
| 263 |
/polygone { |
|---|
| 264 |
gsave |
|---|
| 265 |
polygone_ |
|---|
| 266 |
starfill |
|---|
| 267 |
currentlinewidth 0 eq {} {stroke} ifelse |
|---|
| 268 |
grestore |
|---|
| 269 |
} def |
|---|
| 270 |
|
|---|
| 271 |
%% syntaxe : x y point |
|---|
| 272 |
/point { |
|---|
| 273 |
gsave |
|---|
| 274 |
1 setlinecap |
|---|
| 275 |
newpath |
|---|
| 276 |
smoveto |
|---|
| 277 |
0 0 rlineto |
|---|
| 278 |
5 setlinewidth |
|---|
| 279 |
stroke |
|---|
| 280 |
grestore |
|---|
| 281 |
} def |
|---|
| 282 |
|
|---|
| 283 |
/point_ { |
|---|
| 284 |
1 setlinecap |
|---|
| 285 |
5 setlinewidth |
|---|
| 286 |
smoveto |
|---|
| 287 |
0 0 rlineto |
|---|
| 288 |
} def |
|---|
| 289 |
|
|---|
| 290 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 291 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 292 |
%%%% %%%% |
|---|
| 293 |
%%%% insertion librairie jps %%%% |
|---|
| 294 |
%%%% %%%% |
|---|
| 295 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 296 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 297 |
|
|---|
| 298 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 299 |
%%%% le repere jps %%%% |
|---|
| 300 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 301 |
|
|---|
| 302 |
%%%%% ### AAAopacity ### |
|---|
| 303 |
%% les parametres pour la gestion de la transparence |
|---|
| 304 |
/setstrokeopacity { |
|---|
| 305 |
/strokeopacity exch def |
|---|
| 306 |
} def |
|---|
| 307 |
/setfillopacity { |
|---|
| 308 |
/fillopacity exch def |
|---|
| 309 |
} def |
|---|
| 310 |
%% d apres un code de Jean-Michel Sarlat |
|---|
| 311 |
%% http://melusine.eu.org/syracuse/swf/pdf2swf/setdash/ |
|---|
| 312 |
%% Mise en reserve de la procedure stroke originelle. |
|---|
| 313 |
/sysstroke {systemdict /stroke get exec} def |
|---|
| 314 |
/sysfill {systemdict /fill get exec} def |
|---|
| 315 |
/sysatan {systemdict /atan get exec} def |
|---|
| 316 |
/atan {2 copy 0 0 eqp {pop pop 0} {sysatan} ifelse} def |
|---|
| 317 |
% Mise en place de la nouvelle procedure |
|---|
| 318 |
/stroke { |
|---|
| 319 |
/strokeopacity where { |
|---|
| 320 |
/strokeopacity get |
|---|
| 321 |
} { |
|---|
| 322 |
1 |
|---|
| 323 |
} ifelse |
|---|
| 324 |
.setopacityalpha sysstroke |
|---|
| 325 |
} def |
|---|
| 326 |
/fill { |
|---|
| 327 |
/fillopacity where { |
|---|
| 328 |
/fillopacity get |
|---|
| 329 |
} { |
|---|
| 330 |
1 |
|---|
| 331 |
} ifelse |
|---|
| 332 |
.setopacityalpha sysfill |
|---|
| 333 |
} def |
|---|
| 334 |
|
|---|
| 335 |
%%%%% ### AAAscale ### |
|---|
| 336 |
%%%%%%%%%%%%%%%% les deplacements a l echelle %%%%%%%%%%%%%%%%%%% |
|---|
| 337 |
|
|---|
| 338 |
/v@ct_I {xunit 0} def |
|---|
| 339 |
/v@ct_J {angle_repere cos yunit mul angle_repere sin yunit mul} def |
|---|
| 340 |
|
|---|
| 341 |
/xscale {} def |
|---|
| 342 |
/yscale {} def |
|---|
| 343 |
|
|---|
| 344 |
/xscale-1 {} def |
|---|
| 345 |
/yscale-1 {} def |
|---|
| 346 |
|
|---|
| 347 |
/gtransform {} def |
|---|
| 348 |
/gtransform-1 {} def |
|---|
| 349 |
|
|---|
| 350 |
/jtoppoint { |
|---|
| 351 |
2 dict begin |
|---|
| 352 |
gtransform |
|---|
| 353 |
/y exch yscale def |
|---|
| 354 |
/x exch xscale def |
|---|
| 355 |
v@ct_I x mulv |
|---|
| 356 |
v@ct_J y mulv |
|---|
| 357 |
addv |
|---|
| 358 |
end |
|---|
| 359 |
} def |
|---|
| 360 |
|
|---|
| 361 |
/rptojpoint { |
|---|
| 362 |
xtranslate ytranslate |
|---|
| 363 |
3 1 roll %% xA yB yA xB |
|---|
| 364 |
4 1 roll %% xB xA yB yA |
|---|
| 365 |
sub neg 3 1 roll %% yB-yA xB xA |
|---|
| 366 |
sub neg exch |
|---|
| 367 |
ptojpoint |
|---|
| 368 |
} def |
|---|
| 369 |
|
|---|
| 370 |
/rptoppoint { |
|---|
| 371 |
xtranslate ytranslate |
|---|
| 372 |
3 1 roll %% xA yB yA xB |
|---|
| 373 |
4 1 roll %% xB xA yB yA |
|---|
| 374 |
sub neg 3 1 roll %% yB-yA xB xA |
|---|
| 375 |
sub neg exch |
|---|
| 376 |
} def |
|---|
| 377 |
|
|---|
| 378 |
/ptojpoint { |
|---|
| 379 |
4 dict begin |
|---|
| 380 |
/Y exch yscale-1 def |
|---|
| 381 |
/X exch xscale-1 def |
|---|
| 382 |
/y Y yunit angle_repere sin mul div def |
|---|
| 383 |
/x X y yunit mul angle_repere cos mul sub xunit div def |
|---|
| 384 |
x y |
|---|
| 385 |
gtransform-1 |
|---|
| 386 |
end |
|---|
| 387 |
} def |
|---|
| 388 |
|
|---|
| 389 |
/smoveto { |
|---|
| 390 |
jtoppoint |
|---|
| 391 |
moveto |
|---|
| 392 |
} def |
|---|
| 393 |
|
|---|
| 394 |
/srmoveto { |
|---|
| 395 |
jtoppoint |
|---|
| 396 |
rmoveto |
|---|
| 397 |
} def |
|---|
| 398 |
|
|---|
| 399 |
/slineto { |
|---|
| 400 |
jtoppoint |
|---|
| 401 |
lineto |
|---|
| 402 |
} def |
|---|
| 403 |
|
|---|
| 404 |
/srlineto { |
|---|
| 405 |
jtoppoint |
|---|
| 406 |
rlineto |
|---|
| 407 |
} def |
|---|
| 408 |
|
|---|
| 409 |
/stranslate { |
|---|
| 410 |
jtoppoint |
|---|
| 411 |
translate |
|---|
| 412 |
} def |
|---|
| 413 |
|
|---|
| 414 |
%%%%% ### fin insertion ### |
|---|
| 415 |
|
|---|
| 416 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 417 |
%%%% methodes numeriques %%%% |
|---|
| 418 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 419 |
|
|---|
| 420 |
%%%%% ### solve2nddegre ### |
|---|
| 421 |
%% syntaxe : a b c solve2nddegre --> x1 x2 |
|---|
| 422 |
/solve2nddegre { |
|---|
| 423 |
5 dict begin |
|---|
| 424 |
/@c exch def |
|---|
| 425 |
/@b exch def |
|---|
| 426 |
/@a exch def |
|---|
| 427 |
/delt@ @b dup mul 4 @a mul @c mul sub def |
|---|
| 428 |
@b neg delt@ sqrt sub 2 @a mul div |
|---|
| 429 |
@b neg delt@ sqrt add 2 @a mul div |
|---|
| 430 |
end |
|---|
| 431 |
} def |
|---|
| 432 |
|
|---|
| 433 |
%%%%% ### fin insertion ### |
|---|
| 434 |
|
|---|
| 435 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 436 |
%%%% la 2D %%%% |
|---|
| 437 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 438 |
|
|---|
| 439 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 440 |
%%%% points %%%% |
|---|
| 441 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 442 |
|
|---|
| 443 |
%%%%% ### tripointangle ### |
|---|
| 444 |
%% syntaxe : A B C tripointangle --> angle ABC |
|---|
| 445 |
/tripointangle { |
|---|
| 446 |
9 dict begin |
|---|
| 447 |
/yC exch def |
|---|
| 448 |
/xC exch def |
|---|
| 449 |
/yB exch def |
|---|
| 450 |
/xB exch def |
|---|
| 451 |
/yA exch def |
|---|
| 452 |
/xA exch def |
|---|
| 453 |
/A {xA yA} def |
|---|
| 454 |
/B {xB yB} def |
|---|
| 455 |
/C {xC yC} def |
|---|
| 456 |
B C angle |
|---|
| 457 |
B A angle |
|---|
| 458 |
sub |
|---|
| 459 |
end |
|---|
| 460 |
} def |
|---|
| 461 |
|
|---|
| 462 |
%%%%% ### angle ### |
|---|
| 463 |
%% syntaxe : A B angle |
|---|
| 464 |
%% --> num, l'angle defini par le vecteur AB dans le repere orthonorme jps |
|---|
| 465 |
/angle { |
|---|
| 466 |
vecteur exch atan |
|---|
| 467 |
dup 180 gt |
|---|
| 468 |
{360 sub} |
|---|
| 469 |
if |
|---|
| 470 |
} def |
|---|
| 471 |
|
|---|
| 472 |
%% syntaxe : A B pangle |
|---|
| 473 |
%% --> num, l'angle defini par le vecteur AB dans le repere postscript |
|---|
| 474 |
/pangle { |
|---|
| 475 |
jtoppoint exchp jtoppoint exchp vecteur exch atan |
|---|
| 476 |
dup 180 gt |
|---|
| 477 |
{360 sub} |
|---|
| 478 |
if |
|---|
| 479 |
} def |
|---|
| 480 |
|
|---|
| 481 |
%%%%% ### setxrange ### |
|---|
| 482 |
/setxrange { |
|---|
| 483 |
/xmax exch def |
|---|
| 484 |
/xmin exch def |
|---|
| 485 |
} def |
|---|
| 486 |
|
|---|
| 487 |
%%%%% ### setyrange ### |
|---|
| 488 |
/setyrange { |
|---|
| 489 |
/ymax exch def |
|---|
| 490 |
/ymin exch def |
|---|
| 491 |
} def |
|---|
| 492 |
|
|---|
| 493 |
%%%%% ### defpoint ### |
|---|
| 494 |
%% syntaxe : xA yA /A defpoint |
|---|
| 495 |
/defpoint { |
|---|
| 496 |
1 dict begin |
|---|
| 497 |
/t@mp@r@ire exch def |
|---|
| 498 |
[ 3 1 roll ] cvx t@mp@r@ire exch |
|---|
| 499 |
end def |
|---|
| 500 |
} def |
|---|
| 501 |
|
|---|
| 502 |
%%%%% ### milieu ### |
|---|
| 503 |
%% syntaxe~: A B milieu |
|---|
| 504 |
/milieu { |
|---|
| 505 |
%% xA yA xB yB |
|---|
| 506 |
3 -1 roll %% xA xB yB yA |
|---|
| 507 |
add 2 div %% xA xB yM |
|---|
| 508 |
3 1 roll %% yM xA xB |
|---|
| 509 |
add 2 div %% yM xM |
|---|
| 510 |
exch |
|---|
| 511 |
} def |
|---|
| 512 |
|
|---|
| 513 |
%%%%% ### parallelopoint ### |
|---|
| 514 |
%% syntaxe : A B C parallelopoint --> point D, tel que ABCD parallelogramme |
|---|
| 515 |
/parallelopoint { |
|---|
| 516 |
11 dict begin |
|---|
| 517 |
/yC exch def |
|---|
| 518 |
/xC exch def |
|---|
| 519 |
/yB exch def |
|---|
| 520 |
/xB exch def |
|---|
| 521 |
/yA exch def |
|---|
| 522 |
/xA exch def |
|---|
| 523 |
/A {xA yA} def |
|---|
| 524 |
/B {xB yB} def |
|---|
| 525 |
/C {xC yC} def |
|---|
| 526 |
/d1 {A B C paral} def |
|---|
| 527 |
/d2 {B C A paral} def |
|---|
| 528 |
d1 d2 interdroite |
|---|
| 529 |
end |
|---|
| 530 |
} def |
|---|
| 531 |
|
|---|
| 532 |
%%%%% ### translatepoint ### |
|---|
| 533 |
%% syntaxe : A u translatepoint --> B image de A par la translation de vecteur u |
|---|
| 534 |
/translatepoint { |
|---|
| 535 |
addv |
|---|
| 536 |
} def |
|---|
| 537 |
|
|---|
| 538 |
%%%%% ### rotatepoint ### |
|---|
| 539 |
%% syntaxe : B A r rotatepoint --> C image de B par la rotation de centre A, |
|---|
| 540 |
%% d'angle r (en degre) |
|---|
| 541 |
%% En prenant les affixes des pts associes, il vient |
|---|
| 542 |
%% (zC - zA) = (zB-zA) e^(ir) |
|---|
| 543 |
%% soit |
|---|
| 544 |
%% zC = (zB-zA) e^(ir) + zA |
|---|
| 545 |
/rotatepoint { %% B, A, r |
|---|
| 546 |
5 copy %% B, A, r, B, A, r |
|---|
| 547 |
cos 5 1 roll %% B, A, r, cos r, B, A |
|---|
| 548 |
4 1 roll %% B, A, r, cos r, yA, B, xA |
|---|
| 549 |
4 1 roll %% B, A, r, cos r, A, B |
|---|
| 550 |
vecteur %% B, A, r, cos r, xB-xA, yB-yA |
|---|
| 551 |
4 -1 roll sin %% B, A, cos r, xB-xA, yB-yA, sin r |
|---|
| 552 |
4 copy mul %% B, A, cos r, xB-xA, yB-yA, sin r, cos r, xB-xA, (yB-yA) sin r |
|---|
| 553 |
7 1 roll mul %% B, A, (yB-yA) sin r, cos r, xB-xA, yB-yA, sin r, cos r (xB-xA) |
|---|
| 554 |
5 1 roll %% B, A, (yB-yA) sin r, cos r (xB-xA), cos r, xB-xA, yB-yA, sin r |
|---|
| 555 |
exch %% B, A, (yB-yA) sin r, cos r (xB-xA), cos r, xB-xA, sin r, yB-yA |
|---|
| 556 |
4 -1 roll mul %% B, A, (yB-yA) sin r, cos r (xB-xA), xB-xA, sin r, (yB-yA)cos r |
|---|
| 557 |
3 1 roll mul %% B, A, (yB-yA) sin r, cos r (xB-xA), (yB-yA) cos r, (xB-xA) sin r |
|---|
| 558 |
add %% B, A, (yB-yA) sin r, cos r (xB-xA), (yB-yA) cos r +(xB-xA) sin r |
|---|
| 559 |
3 1 roll %% B, A, (yB-yA) cos r + (xB-xA) sin r, (yB-yA) sin r, cos r (xB-xA), |
|---|
| 560 |
exch sub %% B, A, (yB-yA) cos r + (xB-xA) sin r, cos r (xB-xA)-(yB-yA) sin r |
|---|
| 561 |
exch %% B, zA, (zB-zA) e^(ir) |
|---|
| 562 |
addv |
|---|
| 563 |
3 -1 roll pop |
|---|
| 564 |
3 -1 roll pop |
|---|
| 565 |
} def |
|---|
| 566 |
|
|---|
| 567 |
%%%%% ### hompoint ### |
|---|
| 568 |
%% syntaxe : B A alpha hompoint -> le point A' tel que AA' = alpha AB |
|---|
| 569 |
/hompoint { |
|---|
| 570 |
5 copy |
|---|
| 571 |
pop |
|---|
| 572 |
vecteur %% vecteur BA |
|---|
| 573 |
3 -1 roll |
|---|
| 574 |
neg |
|---|
| 575 |
mulv %% alpha x vecteur AB |
|---|
| 576 |
addv |
|---|
| 577 |
4 -1 roll |
|---|
| 578 |
4 -1 roll |
|---|
| 579 |
pop pop |
|---|
| 580 |
} def |
|---|
| 581 |
|
|---|
| 582 |
%%%%% ### orthoproj ### |
|---|
| 583 |
%% syntaxe : A D orthoproj --> B, le projete orthogonal de A sur D |
|---|
| 584 |
/orthoproj { |
|---|
| 585 |
6 -1 roll |
|---|
| 586 |
6 -1 roll %% D A |
|---|
| 587 |
6 copy %% D A D A |
|---|
| 588 |
7 -1 roll pop |
|---|
| 589 |
7 -1 roll pop %% D D A |
|---|
| 590 |
perp |
|---|
| 591 |
interdroite |
|---|
| 592 |
} def |
|---|
| 593 |
|
|---|
| 594 |
%% syntaxe : A projx --> le projete orthogonal de A sur Ox |
|---|
| 595 |
/projx { |
|---|
| 596 |
pop 0 |
|---|
| 597 |
} def |
|---|
| 598 |
|
|---|
| 599 |
%% syntaxe : A projy --> le projete orthogonal de A sur Oy |
|---|
| 600 |
/projy { |
|---|
| 601 |
exch pop 0 exch |
|---|
| 602 |
} def |
|---|
| 603 |
|
|---|
| 604 |
%%%%% ### sympoint ### |
|---|
| 605 |
%% syntaxe : A I sympoint --> point A', le symetrique de A par rapport |
|---|
| 606 |
%% au point I |
|---|
| 607 |
/sympoint { |
|---|
| 608 |
4 copy |
|---|
| 609 |
pop pop |
|---|
| 610 |
vecteur |
|---|
| 611 |
-2 mulv |
|---|
| 612 |
addv |
|---|
| 613 |
} def |
|---|
| 614 |
|
|---|
| 615 |
%%%%% ### axesympoint ### |
|---|
| 616 |
%% syntaxe : A D axesympoint --> point B, le symetrique de A par rapport |
|---|
| 617 |
%% a la droite D |
|---|
| 618 |
/axesympoint { |
|---|
| 619 |
2 dict begin |
|---|
| 620 |
6 copy |
|---|
| 621 |
pop pop pop pop |
|---|
| 622 |
/yA exch def |
|---|
| 623 |
/xA exch def |
|---|
| 624 |
orthoproj |
|---|
| 625 |
xA yA vecteur |
|---|
| 626 |
-2 mulv |
|---|
| 627 |
xA yA addv |
|---|
| 628 |
end |
|---|
| 629 |
} def |
|---|
| 630 |
|
|---|
| 631 |
%%%%% ### cpoint ### |
|---|
| 632 |
%% syntaxe : alpha C cpoint -> M, le point du cercle C correspondant a |
|---|
| 633 |
%% l'angle alpha |
|---|
| 634 |
/cpoint { %% a, xI, yI, r |
|---|
| 635 |
1 dict begin |
|---|
| 636 |
dup %% a, xI, yI, r, r |
|---|
| 637 |
5 -1 roll %% xI, yI, r, r, a |
|---|
| 638 |
/alpha exch def |
|---|
| 639 |
alpha cos mul %% xI, yI, r, r cos a |
|---|
| 640 |
exch |
|---|
| 641 |
alpha sin mul %% xI, yI, r cos a, r sin a |
|---|
| 642 |
3 -1 roll add %% xI, r cos a, yI + r sin a |
|---|
| 643 |
3 1 roll %% yI + r sin a, xI, r cos a, |
|---|
| 644 |
add exch %% xI + r cos a, yI + r sin a |
|---|
| 645 |
end |
|---|
| 646 |
} def |
|---|
| 647 |
|
|---|
| 648 |
%%%%% ### xdpoint ### |
|---|
| 649 |
%% x A B xdpoint : le point de la droite (AB) d'abscisse x |
|---|
| 650 |
/xdpoint { |
|---|
| 651 |
5 dict begin |
|---|
| 652 |
/pt2 defpoint |
|---|
| 653 |
/pt1 defpoint |
|---|
| 654 |
/x exch def |
|---|
| 655 |
/a pt1 pt2 coeffdir def |
|---|
| 656 |
/b pt1 pt2 ordorig def |
|---|
| 657 |
x dup a mul b add |
|---|
| 658 |
end |
|---|
| 659 |
} def |
|---|
| 660 |
|
|---|
| 661 |
%%%%% ### ydpoint ### |
|---|
| 662 |
%% y A B ydpoint : le point de la droite (AB) d'ordonnee y |
|---|
| 663 |
/ydpoint { |
|---|
| 664 |
5 dict begin |
|---|
| 665 |
/pt2 defpoint |
|---|
| 666 |
/pt1 defpoint |
|---|
| 667 |
/y exch def |
|---|
| 668 |
pt1 pt2 verticale? |
|---|
| 669 |
{ |
|---|
| 670 |
pt1 pop y |
|---|
| 671 |
} |
|---|
| 672 |
{ |
|---|
| 673 |
/a pt1 pt2 coeffdir def |
|---|
| 674 |
/b pt1 pt2 ordorig def |
|---|
| 675 |
y b sub a div y |
|---|
| 676 |
} |
|---|
| 677 |
ifelse |
|---|
| 678 |
end |
|---|
| 679 |
} def |
|---|
| 680 |
|
|---|
| 681 |
%%%%% ### ordonnepoints ### |
|---|
| 682 |
%% syntaxe : xA yA xB yB ordonnepoints --> idem si yB>yA ou si yB=yA |
|---|
| 683 |
%% avec xB>xA, sinon xB yB xA yA |
|---|
| 684 |
/ordonnepoints { |
|---|
| 685 |
4 copy |
|---|
| 686 |
exch pop %% ... xA, yA, yB |
|---|
| 687 |
lt %% yA < yB ? |
|---|
| 688 |
{pop} %% oui, c'est fini |
|---|
| 689 |
{ %% non : yA >= yB |
|---|
| 690 |
pop 4 copy |
|---|
| 691 |
exch pop %% ... xA, yA, yB |
|---|
| 692 |
eq %% yA = yB ? |
|---|
| 693 |
{ |
|---|
| 694 |
3 copy %% oui, yA = yB |
|---|
| 695 |
pop pop %% ... xA, xB |
|---|
| 696 |
le %% xA =< xB ? |
|---|
| 697 |
{} %% oui, c'est fini |
|---|
| 698 |
{ %% non, on echange A et B |
|---|
| 699 |
4 -1 roll |
|---|
| 700 |
4 -1 roll |
|---|
| 701 |
} |
|---|
| 702 |
ifelse |
|---|
| 703 |
} |
|---|
| 704 |
{ %% non : yA < yB => on echange A et B |
|---|
| 705 |
pop |
|---|
| 706 |
4 -1 roll |
|---|
| 707 |
4 -1 roll |
|---|
| 708 |
} |
|---|
| 709 |
ifelse |
|---|
| 710 |
} |
|---|
| 711 |
ifelse |
|---|
| 712 |
} def |
|---|
| 713 |
|
|---|
| 714 |
%%%%% ### distance ### |
|---|
| 715 |
%% syntaxe~: A B distance |
|---|
| 716 |
/distance { %% xA yA xB yB |
|---|
| 717 |
vecteur %% x y |
|---|
| 718 |
dup mul exch %% y^2 x |
|---|
| 719 |
dup mul %% y^2 x^2 |
|---|
| 720 |
add |
|---|
| 721 |
sqrt |
|---|
| 722 |
} def |
|---|
| 723 |
|
|---|
| 724 |
%%%%% ### dup ### |
|---|
| 725 |
/dupp {2 copy} def |
|---|
| 726 |
/dupc {3 copy} def |
|---|
| 727 |
/dupd {4 copy} def |
|---|
| 728 |
|
|---|
| 729 |
%%%%% ### fin insertion ### |
|---|
| 730 |
/interdroites {interdroite} def |
|---|
| 731 |
|
|---|
| 732 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 733 |
%%%% vecteurs %%%% |
|---|
| 734 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 735 |
|
|---|
| 736 |
%%%%% ### vecteur ### |
|---|
| 737 |
%% syntaxe~: A B vecteur |
|---|
| 738 |
/vecteur { |
|---|
| 739 |
%% xA yA xB yB |
|---|
| 740 |
3 -1 roll %% xA xB yB yA |
|---|
| 741 |
sub %% xA xB yB-yA |
|---|
| 742 |
3 1 roll %% yB-yA xA xB |
|---|
| 743 |
exch sub %% yB-yA xB-xA |
|---|
| 744 |
exch |
|---|
| 745 |
} def |
|---|
| 746 |
|
|---|
| 747 |
%%%%% ### normalize ### |
|---|
| 748 |
%% syntaxe : u normalize -> u / ||u|| |
|---|
| 749 |
/normalize { |
|---|
| 750 |
2 dict begin |
|---|
| 751 |
/u defpoint |
|---|
| 752 |
/n u norme def |
|---|
| 753 |
u 1 n div mulv |
|---|
| 754 |
end |
|---|
| 755 |
} def |
|---|
| 756 |
|
|---|
| 757 |
%%%%% ### addv ### |
|---|
| 758 |
%% syntaxe : u v addv --> u+v |
|---|
| 759 |
/addv { %% xA yA xB yB |
|---|
| 760 |
3 1 roll %% xA yB yA xB |
|---|
| 761 |
4 1 roll %% xB xA yB yA |
|---|
| 762 |
add 3 1 roll %% yB+yA xB xA |
|---|
| 763 |
add exch |
|---|
| 764 |
} def |
|---|
| 765 |
|
|---|
| 766 |
%%%%% ### subv ### |
|---|
| 767 |
%% syntaxe : u v subv --> u - v |
|---|
| 768 |
/subv { %% xA yA xB yB |
|---|
| 769 |
-1 mulv |
|---|
| 770 |
addv |
|---|
| 771 |
} def |
|---|
| 772 |
|
|---|
| 773 |
%%%%% ### mulv ### |
|---|
| 774 |
%% syntaxe : u a mulv --> au |
|---|
| 775 |
/mulv { %% xA, yA, a |
|---|
| 776 |
dup %% xA, yA, a, a |
|---|
| 777 |
3 1 roll %% xA, a, yA, a |
|---|
| 778 |
mul 3 1 roll %% ayA, xA, a |
|---|
| 779 |
mul exch |
|---|
| 780 |
} def |
|---|
| 781 |
|
|---|
| 782 |
%%%%% ### scalprod ### |
|---|
| 783 |
%% syntaxe : u v scalprod --> le produit scalaire de u par v |
|---|
| 784 |
/scalprod { |
|---|
| 785 |
2 dict begin |
|---|
| 786 |
/y' exch def |
|---|
| 787 |
exch |
|---|
| 788 |
/y exch def |
|---|
| 789 |
mul y y' mul add |
|---|
| 790 |
end |
|---|
| 791 |
} def |
|---|
| 792 |
|
|---|
| 793 |
%%%%% ### normal ### |
|---|
| 794 |
%% syntaxe : u normal --> v tel u.v = 0 |
|---|
| 795 |
/normal { |
|---|
| 796 |
neg exch |
|---|
| 797 |
} def |
|---|
| 798 |
|
|---|
| 799 |
%%%%% ### norme ### |
|---|
| 800 |
%% syntaxe : u norme --> |u| |
|---|
| 801 |
/norme { |
|---|
| 802 |
dup mul |
|---|
| 803 |
exch |
|---|
| 804 |
dup mul |
|---|
| 805 |
add sqrt |
|---|
| 806 |
} def |
|---|
| 807 |
|
|---|
| 808 |
%%%%% ### oldarrow ### |
|---|
| 809 |
%% syntaxe : A B oldarrow --> trace fleche en B, direction AB |
|---|
| 810 |
/oldarrow { |
|---|
| 811 |
4 dict begin |
|---|
| 812 |
gsave |
|---|
| 813 |
/B defpoint |
|---|
| 814 |
/A defpoint |
|---|
| 815 |
oldarrowscale scale |
|---|
| 816 |
oldarrowangle rotate |
|---|
| 817 |
newpath |
|---|
| 818 |
B smoveto |
|---|
| 819 |
A B vecteur normalize /u defpoint |
|---|
| 820 |
u neg exch /v defpoint |
|---|
| 821 |
u oldarrowpointe neg mulv rmoveto %% ainsi c'est la pointe qui est en (0, 0) |
|---|
| 822 |
%% le pt extremal arriere haut |
|---|
| 823 |
u oldarrowplume neg mulv %% l'abscisse |
|---|
| 824 |
v oldarrow@ngle sin oldarrow@ngle cos div oldarrowplume mul mulv addv %% l'ordonnee |
|---|
| 825 |
rlineto |
|---|
| 826 |
u oldarrowplume oldarrowpointe add mulv |
|---|
| 827 |
v oldarrow@ngle sin oldarrow@ngle cos div oldarrowplume mul neg mulv addv |
|---|
| 828 |
rlineto |
|---|
| 829 |
u oldarrowplume oldarrowpointe add neg mulv |
|---|
| 830 |
v oldarrow@ngle sin oldarrow@ngle cos div oldarrowplume mul neg mulv addv |
|---|
| 831 |
rlineto |
|---|
| 832 |
closepath fill |
|---|
| 833 |
grestore |
|---|
| 834 |
end |
|---|
| 835 |
} def |
|---|
| 836 |
|
|---|
| 837 |
/oldarrowpointe {xunit 5 div} def |
|---|
| 838 |
/oldarrowplume {xunit 10 div} def |
|---|
| 839 |
/oldarrow@ngle 45 def |
|---|
| 840 |
/oldarrowscale {1 1} def |
|---|
| 841 |
/oldarrowangle 0 def %% pour l'utilisateur |
|---|
| 842 |
|
|---|
| 843 |
%%%%% ### drawvecteur ### |
|---|
| 844 |
%% syntaxe : A B drawvecteur |
|---|
| 845 |
/drawvecteur { |
|---|
| 846 |
2 dict begin |
|---|
| 847 |
/B defpoint |
|---|
| 848 |
/A defpoint |
|---|
| 849 |
[A B] ligne |
|---|
| 850 |
A B oldarrow |
|---|
| 851 |
end |
|---|
| 852 |
} def |
|---|
| 853 |
|
|---|
| 854 |
%%%%% ### orthovecteur ### |
|---|
| 855 |
%% syntaxe : u orthovecteur --> v, vecteur orthogonal a u |
|---|
| 856 |
/orthovecteur { |
|---|
| 857 |
neg exch |
|---|
| 858 |
} def |
|---|
| 859 |
|
|---|
| 860 |
%%%%% ### fin insertion ### |
|---|
| 861 |
|
|---|
| 862 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 863 |
%%%% cercles %%%% |
|---|
| 864 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 865 |
|
|---|
| 866 |
%%%%% ### defcercle ### |
|---|
| 867 |
%% syntaxe : A r /d defcercle |
|---|
| 868 |
/defcercle { |
|---|
| 869 |
1 dict begin |
|---|
| 870 |
/t@mp@r@ire exch def |
|---|
| 871 |
[ 4 1 roll ] cvx t@mp@r@ire exch |
|---|
| 872 |
end def |
|---|
| 873 |
} def |
|---|
| 874 |
|
|---|
| 875 |
%%%%% ### interdroitecercle ### |
|---|
| 876 |
%% intersection de la droite y = ax+b avec le cercle (x-x0)^2 + (y-y0)^2 = r^2 |
|---|
| 877 |
%% { -- b - y 2 2 3 |
|---|
| 878 |
%% { | x = - -----, y = (b + a x0 + a y0 + (2 a b y0 - 2 a b x0 + |
|---|
| 879 |
%% { -- a |
|---|
| 880 |
%% |
|---|
| 881 |
%% 3 2 2 2 2 4 2 2 2 4 2 2 |
|---|
| 882 |
%% 2 a x0 y0 - a b + a r + a r - a y0 - a x0 )^(1/2)) / (a + 1) |
|---|
| 883 |
%% |
|---|
| 884 |
%% |
|---|
| 885 |
%% -- |
|---|
| 886 |
%% |, |
|---|
| 887 |
%% -- |
|---|
| 888 |
%% -- b - y 2 2 3 |
|---|
| 889 |
%% | x = - -----, y = (b + a x0 + a y0 - (2 a b y0 - 2 a b x0 + |
|---|
| 890 |
%% -- a |
|---|
| 891 |
%% |
|---|
| 892 |
%% 3 2 2 2 2 4 2 2 2 4 2 2 |
|---|
| 893 |
%% 2 a x0 y0 - a b + a r + a r - a y0 - a x0 )^(1/2)) / (a + 1) |
|---|
| 894 |
%% |
|---|
| 895 |
%% -- } |
|---|
| 896 |
%% | } |
|---|
| 897 |
%% -- } |
|---|
| 898 |
|
|---|
| 899 |
%% intersection de la droite x = a avec le cercle (x-x0)^2 + (y-y0)^2 = r^2 |
|---|
| 900 |
%% 2 2 2 1/2 |
|---|
| 901 |
%% {[x = a, y = y0 + (2 a x0 - a + r - x0 ) ], |
|---|
| 902 |
%% |
|---|
| 903 |
%% 2 2 2 1/2 |
|---|
| 904 |
%% [x = a, y = y0 - (2 a x0 - a + r - x0 ) ]} |
|---|
| 905 |
|
|---|
| 906 |
%% intersection de la droite y = b avec le cercle (x-x0)^2 + (y-y0)^2 = r^2 |
|---|
| 907 |
%% 2 2 2 1/2 |
|---|
| 908 |
%% {[y = b, x = x0 + (2 b y0 - b + r - y0 ) ], |
|---|
| 909 |
%% |
|---|
| 910 |
%% 2 2 2 1/2 |
|---|
| 911 |
%% [y = b, x = x0 - (2 b y0 - b + r - y0 ) ]} |
|---|
| 912 |
|
|---|
| 913 |
%% syntaxe : D I r interdroitecercle |
|---|
| 914 |
/interdroitecercle { |
|---|
| 915 |
16 dict begin |
|---|
| 916 |
/r exch def |
|---|
| 917 |
/y0 exch def |
|---|
| 918 |
/x0 exch def |
|---|
| 919 |
/yB exch def |
|---|
| 920 |
/xB exch def |
|---|
| 921 |
/yA exch def |
|---|
| 922 |
/xA exch def |
|---|
| 923 |
|
|---|
| 924 |
xA yA xB yB verticale? |
|---|
| 925 |
|
|---|
| 926 |
%% la droite est verticale |
|---|
| 927 |
{ |
|---|
| 928 |
/xpt1 xA def |
|---|
| 929 |
/xpt2 xA def |
|---|
| 930 |
/quantite |
|---|
| 931 |
2 xA mul x0 mul xA dup mul sub r dup mul add x0 dup mul sub sqrt |
|---|
| 932 |
def |
|---|
| 933 |
/ypt1 |
|---|
| 934 |
y0 quantite add |
|---|
| 935 |
def |
|---|
| 936 |
/ypt2 |
|---|
| 937 |
y0 quantite sub |
|---|
| 938 |
def |
|---|
| 939 |
} |
|---|
| 940 |
|
|---|
| 941 |
%% la droite n'est pas verticale |
|---|
| 942 |
{ |
|---|
| 943 |
/a xA yA xB yB coeffdir def |
|---|
| 944 |
/b xA yA xB yB ordorig def |
|---|
| 945 |
|
|---|
| 946 |
0 a eq |
|---|
| 947 |
%% la droite est horizontale |
|---|
| 948 |
{ |
|---|
| 949 |
/quantite |
|---|
| 950 |
2 b mul y0 mul |
|---|
| 951 |
b dup mul sub |
|---|
| 952 |
r dup mul add |
|---|
| 953 |
y0 dup mul sub |
|---|
| 954 |
sqrt |
|---|
| 955 |
def |
|---|
| 956 |
/xpt1 |
|---|
| 957 |
x0 quantite add |
|---|
| 958 |
def |
|---|
| 959 |
/xpt2 |
|---|
| 960 |
x0 quantite sub |
|---|
| 961 |
def |
|---|
| 962 |
/ypt1 b def |
|---|
| 963 |
/ypt2 b def |
|---|
| 964 |
} |
|---|
| 965 |
|
|---|
| 966 |
%% la droite n'est pas horizontale |
|---|
| 967 |
{ |
|---|
| 968 |
/quantite1 |
|---|
| 969 |
b |
|---|
| 970 |
a x0 mul add |
|---|
| 971 |
a dup mul y0 mul add |
|---|
| 972 |
def |
|---|
| 973 |
/quantite2 |
|---|
| 974 |
2 a dup mul mul b mul y0 mul |
|---|
| 975 |
2 a 3 exp mul b mul x0 mul sub |
|---|
| 976 |
2 a 3 exp mul x0 mul y0 mul add |
|---|
| 977 |
a dup mul b dup mul mul sub |
|---|
| 978 |
a dup mul r dup mul mul add |
|---|
| 979 |
a 4 exp r dup mul mul add |
|---|
| 980 |
a dup mul y0 dup mul mul sub |
|---|
| 981 |
a 4 exp x0 dup mul mul sub |
|---|
| 982 |
sqrt |
|---|
| 983 |
def |
|---|
| 984 |
/quantite3 |
|---|
| 985 |
a dup mul 1 add |
|---|
| 986 |
def |
|---|
| 987 |
/ypt1 |
|---|
| 988 |
quantite1 quantite2 add quantite3 div |
|---|
| 989 |
def |
|---|
| 990 |
/xpt1 |
|---|
| 991 |
ypt1 b sub a div |
|---|
| 992 |
def |
|---|
| 993 |
/ypt2 |
|---|
| 994 |
quantite1 quantite2 sub quantite3 div |
|---|
| 995 |
def |
|---|
| 996 |
/xpt2 |
|---|
| 997 |
ypt2 b sub a div |
|---|
| 998 |
def |
|---|
| 999 |
} |
|---|
| 1000 |
ifelse |
|---|
| 1001 |
} |
|---|
| 1002 |
ifelse |
|---|
| 1003 |
|
|---|
| 1004 |
xpt1 ypt1 |
|---|
| 1005 |
xpt2 ypt2 |
|---|
| 1006 |
ordonnepoints |
|---|
| 1007 |
end |
|---|
| 1008 |
} def |
|---|
| 1009 |
|
|---|
| 1010 |
%%%%% ### intercercle ### |
|---|
| 1011 |
%% syntaxe : cerc1 cerc2 intercercle --> A B les points d'intersection |
|---|
| 1012 |
%% des 2 cercles, tries par 'ordonnepoints' |
|---|
| 1013 |
/intercercle { |
|---|
| 1014 |
12 dict begin |
|---|
| 1015 |
/r2 exch def |
|---|
| 1016 |
/y2 exch def |
|---|
| 1017 |
/x2 exch def |
|---|
| 1018 |
/r1 exch def |
|---|
| 1019 |
/y1 exch def |
|---|
| 1020 |
/x1 exch def |
|---|
| 1021 |
|
|---|
| 1022 |
%% on translate pour se ramener a (x1, y1) = (0, 0) |
|---|
| 1023 |
x2 y2 x1 y1 subv |
|---|
| 1024 |
/y2 exch def |
|---|
| 1025 |
/x2 exch def |
|---|
| 1026 |
|
|---|
| 1027 |
%% on prepare l'equation du 2nd degre |
|---|
| 1028 |
|
|---|
| 1029 |
%% 2 2 2 |
|---|
| 1030 |
%% {y = RootOf((4 x2 + 4 y2 ) _Z |
|---|
| 1031 |
%% |
|---|
| 1032 |
%% 3 2 2 2 4 |
|---|
| 1033 |
%% + (-4 y2 - 4 r1~ y2 + 4 y2 r2~ - 4 x2 y2) _Z + x2 |
|---|
| 1034 |
%% |
|---|
| 1035 |
%% 4 2 2 2 2 2 2 2 2 |
|---|
| 1036 |
%% + r2~ - 2 y2 r2~ + 2 x2 y2 - 2 x2 r2~ - 2 r1~ x2 |
|---|
| 1037 |
%% |
|---|
| 1038 |
%% 4 4 2 2 2 2 |
|---|
| 1039 |
%% + r1~ + y2 + 2 r1~ y2 - 2 r1~ r2~ ), x = 1/2 (-2 y2 |
|---|
| 1040 |
%% |
|---|
| 1041 |
%% 2 2 2 |
|---|
| 1042 |
%% RootOf((4 x2 + 4 y2 ) _Z |
|---|
| 1043 |
%% |
|---|
| 1044 |
%% 3 2 2 2 4 |
|---|
| 1045 |
%% + (-4 y2 - 4 r1~ y2 + 4 y2 r2~ - 4 x2 y2) _Z + x2 |
|---|
| 1046 |
%% |
|---|
| 1047 |
%% 4 2 2 2 2 2 2 2 2 |
|---|
| 1048 |
%% + r2~ - 2 y2 r2~ + 2 x2 y2 - 2 x2 r2~ - 2 r1~ x2 |
|---|
| 1049 |
%% |
|---|
| 1050 |
%% 4 4 2 2 2 2 2 2 2 |
|---|
| 1051 |
%% + r1~ + y2 + 2 r1~ y2 - 2 r1~ r2~ ) + r1~ + x2 + y2 |
|---|
| 1052 |
%% |
|---|
| 1053 |
%% 2 |
|---|
| 1054 |
%% - r2~ )/x2} |
|---|
| 1055 |
|
|---|
| 1056 |
%% coeff pour le degre 2 |
|---|
| 1057 |
/a |
|---|
| 1058 |
%% 2 2 2 |
|---|
| 1059 |
%% {y = RootOf((4 x2 + 4 y2 ) _Z |
|---|
| 1060 |
4 x2 dup mul mul |
|---|
| 1061 |
4 y2 dup mul mul add |
|---|
| 1062 |
def |
|---|
| 1063 |
|
|---|
| 1064 |
%% coeff pour le degre 1 |
|---|
| 1065 |
%% |
|---|
| 1066 |
/b |
|---|
| 1067 |
%% 3 2 2 2 |
|---|
| 1068 |
%% + (-4 y2 - 4 r1~ y2 + 4 y2 r2~ - 4 x2 y2) _Z |
|---|
| 1069 |
-4 y2 3 exp mul |
|---|
| 1070 |
4 r1 dup mul mul y2 mul sub |
|---|
| 1071 |
4 r2 dup mul mul y2 mul add |
|---|
| 1072 |
4 x2 dup mul mul y2 mul sub |
|---|
| 1073 |
def |
|---|
| 1074 |
|
|---|
| 1075 |
%% coeff pour le degre 0 |
|---|
| 1076 |
%% |
|---|
| 1077 |
/c { |
|---|
| 1078 |
%% 4 |
|---|
| 1079 |
%% + x2 |
|---|
| 1080 |
x2 4 exp |
|---|
| 1081 |
%% |
|---|
| 1082 |
%% 4 2 2 2 2 2 2 2 2 |
|---|
| 1083 |
%% + r2~ - 2 y2 r2~ + 2 x2 y2 - 2 x2 r2~ - 2 r1~ x2 |
|---|
| 1084 |
r2 4 exp add |
|---|
| 1085 |
2 y2 dup mul mul r2 dup mul mul sub |
|---|
| 1086 |
2 x2 dup mul mul y2 dup mul mul add |
|---|
| 1087 |
2 x2 dup mul mul r2 dup mul mul sub |
|---|
| 1088 |
2 x2 dup mul mul r1 dup mul mul sub |
|---|
| 1089 |
%% |
|---|
| 1090 |
%% 4 4 2 2 2 2 |
|---|
| 1091 |
%% + r1~ + y2 + 2 r1~ y2 - 2 r1~ r2~ ) |
|---|
| 1092 |
r1 4 exp add |
|---|
| 1093 |
y2 4 exp add |
|---|
| 1094 |
2 r1 dup mul mul y2 dup mul mul add |
|---|
| 1095 |
2 r1 dup mul mul r2 dup mul mul sub |
|---|
| 1096 |
} def |
|---|
| 1097 |
|
|---|
| 1098 |
a b c solve2nddegre |
|---|
| 1099 |
/Y1 exch def |
|---|
| 1100 |
/Y0 exch def |
|---|
| 1101 |
|
|---|
| 1102 |
/X0 |
|---|
| 1103 |
%% x = 1/2 (-2 y2 Y |
|---|
| 1104 |
-2 y2 mul Y0 mul |
|---|
| 1105 |
%% |
|---|
| 1106 |
%% 2 2 2 |
|---|
| 1107 |
%% + r1~ + x2 + y2 |
|---|
| 1108 |
r1 dup mul add |
|---|
| 1109 |
x2 dup mul add |
|---|
| 1110 |
y2 dup mul add |
|---|
| 1111 |
%% |
|---|
| 1112 |
%% 2 |
|---|
| 1113 |
%% - r2~ )/x2} |
|---|
| 1114 |
r2 dup mul sub |
|---|
| 1115 |
|
|---|
| 1116 |
2 x2 mul div |
|---|
| 1117 |
def |
|---|
| 1118 |
|
|---|
| 1119 |
/X1 |
|---|
| 1120 |
%% x = 1/2 (-2 y2 Y |
|---|
| 1121 |
-2 y2 mul Y1 mul |
|---|
| 1122 |
%% |
|---|
| 1123 |
%% 2 2 2 |
|---|
| 1124 |
%% + r1~ + x2 + y2 |
|---|
| 1125 |
r1 dup mul add |
|---|
| 1126 |
x2 dup mul add |
|---|
| 1127 |
y2 dup mul add |
|---|
| 1128 |
%% |
|---|
| 1129 |
%% 2 |
|---|
| 1130 |
%% - r2~ )/x2} |
|---|
| 1131 |
r2 dup mul sub |
|---|
| 1132 |
|
|---|
| 1133 |
2 x2 mul div |
|---|
| 1134 |
def |
|---|
| 1135 |
|
|---|
| 1136 |
%% on depose le resultat, en n'oubliant pas de retranslater en sens |
|---|
| 1137 |
%% inverse |
|---|
| 1138 |
|
|---|
| 1139 |
X0 Y0 x1 y1 addv |
|---|
| 1140 |
X1 Y1 x1 y1 addv |
|---|
| 1141 |
ordonnepoints |
|---|
| 1142 |
end |
|---|
| 1143 |
} def |
|---|
| 1144 |
|
|---|
| 1145 |
%%%%% ### ABcercle ### |
|---|
| 1146 |
%% syntaxe : A B C ABcercle --> le cercle passant par A, B, C |
|---|
| 1147 |
/ABcercle { |
|---|
| 1148 |
3 dict begin |
|---|
| 1149 |
/@3 defpoint |
|---|
| 1150 |
/@2 defpoint |
|---|
| 1151 |
/@1 defpoint |
|---|
| 1152 |
@1 @2 mediatrice |
|---|
| 1153 |
@1 @3 mediatrice |
|---|
| 1154 |
interdroite |
|---|
| 1155 |
dupp |
|---|
| 1156 |
@3 distance |
|---|
| 1157 |
end |
|---|
| 1158 |
} def |
|---|
| 1159 |
|
|---|
| 1160 |
%%%%% ### diamcercle ### |
|---|
| 1161 |
%% syntaxe : A B diamcercle --> le cercle de diametre [AB] |
|---|
| 1162 |
/diamcercle { |
|---|
| 1163 |
4 copy |
|---|
| 1164 |
distance 2 div |
|---|
| 1165 |
5 1 roll |
|---|
| 1166 |
milieu |
|---|
| 1167 |
3 -1 roll |
|---|
| 1168 |
} def |
|---|
| 1169 |
|
|---|
| 1170 |
%%%%% ### fin insertion ### |
|---|
| 1171 |
|
|---|
| 1172 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 1173 |
%%%% droites %%%% |
|---|
| 1174 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 1175 |
|
|---|
| 1176 |
%%%%% ### horizontale ### |
|---|
| 1177 |
%% syntaxe : y horizontale |
|---|
| 1178 |
/horizontale { |
|---|
| 1179 |
1 dict begin |
|---|
| 1180 |
/y exch def |
|---|
| 1181 |
xmin y xmax y |
|---|
| 1182 |
end |
|---|
| 1183 |
} def |
|---|
| 1184 |
|
|---|
| 1185 |
%%%%% ### coeffdir ### |
|---|
| 1186 |
%% syntaxe~: A B coeffdir |
|---|
| 1187 |
/coeffdir { |
|---|
| 1188 |
vecteur exch div |
|---|
| 1189 |
} def |
|---|
| 1190 |
|
|---|
| 1191 |
%%%%% ### ordorig ### |
|---|
| 1192 |
%% syntaxe : A B ordorig |
|---|
| 1193 |
%% attention, la droite est supposee ne pas etre verticale |
|---|
| 1194 |
/ordorig { |
|---|
| 1195 |
/dr@ite 4 array def |
|---|
| 1196 |
dr@ite 3 3 -1 roll put |
|---|
| 1197 |
dr@ite 2 3 -1 roll put |
|---|
| 1198 |
dr@ite 1 3 -1 roll put |
|---|
| 1199 |
dr@ite 0 3 -1 roll put |
|---|
| 1200 |
dr@ite aload pop coeffdir /c@eff exch def |
|---|
| 1201 |
dr@ite aload pop pop pop %% xA yA |
|---|
| 1202 |
exch %% yA xA |
|---|
| 1203 |
c@eff mul neg add |
|---|
| 1204 |
} def |
|---|
| 1205 |
|
|---|
| 1206 |
%%%%% ### verticale ### |
|---|
| 1207 |
%% syntaxe~: A B verticale? |
|---|
| 1208 |
/verticale? { |
|---|
| 1209 |
pop 2 1 roll pop |
|---|
| 1210 |
eq |
|---|
| 1211 |
} def |
|---|
| 1212 |
|
|---|
| 1213 |
%% syntaxe : x verticale |
|---|
| 1214 |
/verticale { |
|---|
| 1215 |
1 dict begin |
|---|
| 1216 |
/x exch def |
|---|
| 1217 |
x ymin x ymax |
|---|
| 1218 |
end |
|---|
| 1219 |
} def |
|---|
| 1220 |
|
|---|
| 1221 |
%%%%% ### droite ### |
|---|
| 1222 |
%% %% syntaxe : A B droite |
|---|
| 1223 |
%% /droite { |
|---|
| 1224 |
%% gsave |
|---|
| 1225 |
%% 6 dict begin |
|---|
| 1226 |
%% /yB exch def |
|---|
| 1227 |
%% /xB exch def |
|---|
| 1228 |
%% /yA exch def |
|---|
| 1229 |
%% /xA exch def |
|---|
| 1230 |
%% xA yA xB yB |
|---|
| 1231 |
%% eqp |
|---|
| 1232 |
%% {} |
|---|
| 1233 |
%% { |
|---|
| 1234 |
%% xA yA xB yB |
|---|
| 1235 |
%% verticale? |
|---|
| 1236 |
%% { |
|---|
| 1237 |
%% newpath |
|---|
| 1238 |
%% xA ymin smoveto |
|---|
| 1239 |
%% xA ymax slineto |
|---|
| 1240 |
%% stockcurrentcpath |
|---|
| 1241 |
%% stroke |
|---|
| 1242 |
%% } |
|---|
| 1243 |
%% { |
|---|
| 1244 |
%% newpath |
|---|
| 1245 |
%% /alpha xA yA xB yB coeffdir def |
|---|
| 1246 |
%% /beta xA yA xB yB ordorig def |
|---|
| 1247 |
%% xmin dup alpha mul beta add smoveto |
|---|
| 1248 |
%% xmax dup alpha mul beta add slineto |
|---|
| 1249 |
%% stockcurrentcpath |
|---|
| 1250 |
%% stroke |
|---|
| 1251 |
%% } |
|---|
| 1252 |
%% ifelse |
|---|
| 1253 |
%% } |
|---|
| 1254 |
%% ifelse |
|---|
| 1255 |
%% end |
|---|
| 1256 |
%% grestore |
|---|
| 1257 |
%% } def |
|---|
| 1258 |
|
|---|
| 1259 |
%% syntaxe : A B droite |
|---|
| 1260 |
/droite { |
|---|
| 1261 |
gsave |
|---|
| 1262 |
6 dict begin |
|---|
| 1263 |
/B defpoint |
|---|
| 1264 |
/A defpoint |
|---|
| 1265 |
A pop B pop eq { |
|---|
| 1266 |
%% droite verticale |
|---|
| 1267 |
newpath |
|---|
| 1268 |
A pop ymin smoveto |
|---|
| 1269 |
A pop ymax slineto |
|---|
| 1270 |
stockcurrentcpath |
|---|
| 1271 |
stroke |
|---|
| 1272 |
} { |
|---|
| 1273 |
%% on cherche le point le + a gauche |
|---|
| 1274 |
xmin A B xdpoint /C defpoint |
|---|
| 1275 |
C exch pop ymin lt { |
|---|
| 1276 |
%% trop a gauche |
|---|
| 1277 |
ymin A B ydpoint /C defpoint |
|---|
| 1278 |
} if |
|---|
| 1279 |
C exch pop ymax gt { |
|---|
| 1280 |
%% trop a gauche |
|---|
| 1281 |
ymax A B ydpoint /C defpoint |
|---|
| 1282 |
} if |
|---|
| 1283 |
%% on cherche le point le + a droite |
|---|
| 1284 |
xmax A B xdpoint /D defpoint |
|---|
| 1285 |
D exch pop ymin lt { |
|---|
| 1286 |
%% trop a droite |
|---|
| 1287 |
ymin A B ydpoint /D defpoint |
|---|
| 1288 |
} if |
|---|
| 1289 |
D exch pop ymax gt { |
|---|
| 1290 |
%% trop a gauche |
|---|
| 1291 |
ymax A B ydpoint /D defpoint |
|---|
| 1292 |
} if |
|---|
| 1293 |
newpath |
|---|
| 1294 |
C smoveto |
|---|
| 1295 |
D slineto |
|---|
| 1296 |
&n |
|---|