Changeset 2258 in Sophya for trunk/SophyaPI
- Timestamp:
- Nov 13, 2002, 1:29:24 AM (23 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pieldrw.cc
r2242 r2258 380 380 { 381 381 if (axesFlags == kAxesNone) return; 382 g->NoClip();382 // g->NoClip(); 383 383 g->SaveGraphicAtt(); 384 384 PIAxes axes; … … 389 389 axes.DrawYCaption(g, labelAtt, axesFlags, yLabel); 390 390 } 391 g->Clip();391 // g->Clip(); 392 392 g->RestoreGraphicAtt(); 393 393 } … … 397 397 { 398 398 SelGraAtt(g); 399 g->NoClip(); // On ne clip pas les BaseDrawer - Reza Nov 2002 399 400 DrawAxes(g); // Trace des axes 400 401 // g->SelFont(PI_NormalSizeFont); -
trunk/SophyaPI/PI/pigraphgen.cc
r2257 r2258 250 250 // Tracé d'un cercle plein centré en "(x0,y0)", de rayon "r" 251 251 // void DrawOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 252 // Tracé d'une ellipse incluse dans le rectangle "(x0,y0)" ,"dx,dy"252 // Tracé d'une ellipse centrée en "(x0,y0)" de demi-axes "dx,dy" 253 253 // void DrawFOval(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 254 // Tracé d'une ellipse pleine incluse dans le rectangle "(x0,y0)" ,"dx,dy"254 // Tracé d'une ellipse pleine centrée en "(x0,y0)" de demi-axes "dx,dy" 255 255 // void DrawPolygon(PIGrCoord *x, PIGrCoord *y, int n, bool cinc=true) 256 256 // Tracé du contour d'un polygone défini par le tableau des "n" points "x,y". … … 261 261 // Tracé d'un polygone plein de la couleur d'avant-plan. 262 262 // void DrawArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, double degdeb, double degfin) 263 // Tracé d'un arc de cercle ou d'ellipse, inclu dans le "(x0,y0)" , "dx,dy" 264 // entre les angles (en degré) "degdeb" - "degfin" 263 // Tracé d'un arc de cercle ou d'ellipse, centrée en "(x0,y0)" de demi-axes "dx,dy" 264 // L'arc couvre un angle "deltadeg" en degré, et commence au point défini 265 // par l'angle "degdeb". Le sens positif angulaire est celui de la rotation 266 // de l'axe X vers Y. Le point (0,1) a 90 deg. (-1,0) a 180 deg. 265 267 // void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, double degdeb, double degfin) 266 // Tracé d'un arc plein, inclu dans le "(x0,y0)" , "dx,dy" 267 // entre les angles (en degré) "degdeb" - "degfin" 268 // Tracé d'un arc de cercle ou d'ellipse plein, centrée en "(x0,y0)" de demi-axes "dx,dy" 269 // L'arc couvre un angle "deltadeg" en degré, et commence au point défini 270 // par l'angle "degdeb". Le sens positif angulaire est celui de la rotation 271 // de l'axe X vers Y. Le point (0,1) a 90 deg. (-1,0) a 180 deg. 268 272 // 269 273 // Draw3PtArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, \ 270 274 // PIGrCoord x3, PIGrCoord y3) 271 // Tracé d'un arc spécifié par trois points "(x1,y1)", "(x2,y2)" et "(x3,y3)"275 // Tracé d'un arc de cercle spécifié par trois points "(x1,y1)", "(x2,y2)" et "(x3,y3)" 272 276 // Draw3PtFArc(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2, \ 273 277 // PIGrCoord x3, PIGrCoord y3) 274 // Tracé d'un arc plein spécifié par trois points "(x1,y1)", "(x2,y2)" et "(x3,y3)"278 // Tracé d'un arc de cercle plein spécifié par trois points "(x1,y1)", "(x2,y2)" et "(x3,y3)" 275 279 //-- 276 280 … … 314 318 } 315 319 320 //++ 321 // ComputeArcFrom3Pt(double x1, double y1, double x2, double y2, \ 322 // double x3, double y3, double& x0, double& y0, 323 // double& dx, double& dy, double& degdeb, double& deltadeg) 324 // Calcul des coordonnees du centre, du rayon, ainsi que l'extension 325 // angulaire d'un arc de cercle specifie par trois points. 326 // *methode statique* 327 //-- 316 328 /* --Methode-- */ 317 329 int PIGraphicGen::ComputeArcFrom3Pt(double x1, double y1, double x2, double y2, … … 322 334 degdeb = deltadeg = 0.; 323 335 double px[2], py[2]; 324 cout << "DBG - Arc3Pt" << x1 << "," << y1 << " - " 325 << x2 << "," << y2 << " - " 326 << x3 << "," << y3 << endl; 336 // cout << "DBG - Arc3Pt" << x1 << "," << y1 << " - " 337 // << x2 << "," << y2 << " - " 338 // << x3 << "," << y3 << endl; 339 327 340 // Milieu de M1-M2 328 341 px[0] = (x1+x2)*0.5; … … 380 393 else { 381 394 if (fabs(dela) < PETIT_DBLE) { 382 cerr << " PIGraphicGen::ComputeArcFrom3Pt()/Error - a[1]-a[0]=" << dela << endl;395 cerr << " PIGraphicGen::ComputeArcFrom3Pt()/Error - a[1]-a[0]=" << dela << " a[0]=" << a[0] << " a[1]=" << a[1] << endl; 383 396 return(3); 384 397 } … … 395 408 double cda = (delx*delx2+dely*dely2)/sqrt(delx*delx+dely*dely)/sqrt(delx2*delx2+dely2*dely2); 396 409 double dang = acos(cda); 410 double sda = 0.; 411 double daopi = 1; 412 if (fabs(dang-M_PI) < 1.e-19) { 413 delx2 = x2-xc; 414 dely2 = y2-yc; 415 // angle M1-O-M2 : Produit vectoriel OM1 X OM2 - Signe de l'angle deltaAngle 416 sda = (delx*dely2-dely*delx2); 417 } 418 else { 397 419 // angle M1-O-M3 : Produit vectoriel OM1 X OM3 - Signe de l'angle deltaAngle 398 doublesda = (delx*dely2-dely*delx2);420 sda = (delx*dely2-dely*delx2); 399 421 // Produit scalaire (OM1 + OM3) . OM2 : deltaAngle ou 2*PI-DeltaAngle 400 delx = (x1+x3)-xc; 401 dely = (y1+y3)-yc; 402 double daopi = (delx*delx2+dely*dely2)/sqrt(delx*delx+dely*dely)/sqrt(delx2*delx2+dely2*dely2); 422 delx = (x1+x3)-2*xc; 423 dely = (y1+y3)-2*yc; 424 daopi = (delx*delx2+dely*dely2)/sqrt(delx*delx+dely*dely) 425 /sqrt(delx2*delx2+dely2*dely2); 426 } 403 427 if (sda >= 0.) { 404 428 if (daopi < 0.) { … … 421 445 } 422 446 } 423 x0 = (xc-r); 424 y0 = (yc-r); 425 dx = dy = 2.*r; 426 cout << "DBG - Arc3Pt-2 " << xc << "," << yc << " R=" << r << " deg= " 427 << degdeb << " Delta= " << deltadeg << endl; 447 while (degdeb < 0.) degdeb += 360.; 448 while (degdeb > 360.) degdeb -= 360.; 449 x0 = xc; 450 y0 = yc; 451 dx = dy = r; 452 // cout << "DBG - Arc3Pt-2 " << xc << "," << yc << " R=" << r << " deg= " 453 // << degdeb << " Delta= " << deltadeg << endl; 428 454 return(0); 429 455 } -
trunk/SophyaPI/PI/pigraphx.cc
r2257 r2258 203 203 { 204 204 XDrawArc(mDisp, mWId, DefGC(), 205 (int)x0 , (int)y0, (int)dx, (int)dy, 0, 360*64);205 (int)x0-(int)dx, (int)y0-(int)dy, (int)dx*2, (int)dy*2, 0, 360*64); 206 206 return; 207 207 } … … 211 211 { 212 212 XFillArc(mDisp, mWId, DefGC(), 213 (int)x0 , (int)y0, (int)dx, (int)dy, 0, 360*64);213 (int)x0-(int)dx, (int)y0-(int)dy, (int)dx*2, (int)dy*2, 0, 360*64); 214 214 return; 215 215 } … … 266 266 degdeb = 360. - (degdeb+deltadeg); 267 267 XDrawArc(mDisp, mWId, DefGC(), 268 (int)x0 , (int)y0, (int)dx, (int)dy, (int)(degdeb*64.), (int)(deltadeg*64.));268 (int)x0-(int)dx, (int)y0-(int)dy, (int)dx*2, (int)dy*2, (int)(degdeb*64.), (int)(deltadeg*64.)); 269 269 return; 270 270 } … … 276 276 degdeb = 360. - (degdeb+deltadeg); 277 277 XFillArc(mDisp, mWId, DefGC(), 278 (int)x0 , (int)y0, (int)dx, (int)dy, (int)(degdeb*64.), (int)(deltadeg*64.));278 (int)x0-(int)dx, (int)y0-(int)dy, (int)dx*2, (int)dy*2, (int)(degdeb*64.), (int)(deltadeg*64.)); 279 279 return; 280 280 } -
trunk/SophyaPI/PI/psfile.cc
r2257 r2258 195 195 closepath savematrix setmatrix } def\n\ 196 196 \ 197 %% pipsarc Arc \n\ 198 /pipsarc {/endangle exch def /startangle exch def /yrad exch def\n\ 199 /xrad exch def /y exch def /x exch def /savematrix mtrx currentmatrix def\n\ 200 x y tr xrad yrad sc 0 0 1 startangle endangle arc\n\ 201 savematrix setmatrix } def\n\ 202 \ 203 %% pipsfarc Arc plein \n\ 204 /pipsfarc {/endangle exch def /startangle exch def /yrad exch def\n\ 205 /xrad exch def /y exch def /x exch def /savematrix mtrx currentmatrix def\n\ 206 x y tr 0 0 moveto xrad yrad sc 0 0 1 startangle endangle arc 0 0 lineto\n\ 207 closepath savematrix setmatrix } def\n\ 208 \ 197 209 %% Gestion des images\n\ 198 210 %% ColorImage, pompee sur xv (qui les avait pompees sur xgrab)\n\ … … 1126 1138 fprintf(mPSFile, "C%d ", mDrawColor); 1127 1139 } 1128 1129 1140 1141 double degfin = degdeb+deltadeg; 1142 while (degfin > 360.) degfin -= 360.; 1143 while (degfin < 0.) degfin += 360.; 1130 1144 /* Dessin */ 1131 fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy %.2f %.2f ellipses gr\n",1132 x0 +dx/2, y0+dy/2, dx/2, dy/2, degdeb, deltadeg) ;1145 fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy %.2f %.2f pipsarc s gr\n", 1146 x0, y0, dx, dy, degdeb, degfin) ; 1133 1147 } 1134 1148 … … 1144 1158 SelectLine(LineAtt); 1145 1159 1160 double degfin = degdeb+deltadeg; 1161 while (degfin > 360.) degfin -= 360.; 1162 while (degfin < 0.) degfin += 360.; 1146 1163 /* Dessin du fond */ 1147 1164 if ( (FillColor != PI_NotDefColor) || (FillColor != mDrawColor) ){ … … 1149 1166 fprintf(mPSFile, "C%d ", mDrawColor) ; 1150 1167 } 1151 fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy %.2f %.2f ellipsef gr\n",1152 x0 +dx/2, y0+dy/2, dx/2, dy/2, degdeb, deltadeg);1168 fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy %.2f %.2f pipsfarc f gr\n", 1169 x0, y0, dx, dy, degdeb, degfin); 1153 1170 1154 1171 /* Dessin du contour (s'il y a lieu) */ … … 1156 1173 mDrawColor = DrawColor; 1157 1174 fprintf(mPSFile, "C%d ", mDrawColor); 1158 fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy %.2f %.2f ellipses gr\n",1159 x0 +dx/2, y0+dy/2, dx/2, dy/2, degdeb, deltadeg) ;1175 fprintf(mPSFile, "gs n %.2f Ux %.2f Uy %.2f Ux %.2f Uy %.2f %.2f pipsfarc s gr\n", 1176 x0, y0, dx, dy, degdeb, degfin) ; 1160 1177 } 1161 1178 }
Note:
See TracChangeset
for help on using the changeset viewer.