#include <string.h>#include <math.h>#include <stdio.h>#include "math_graphics.h"#include "PloEch.h"#include "GetProperty.h"#include "SetProperty.h"#include "DrawObjects.h"#include "Xcall1.h"#include "Plo3d.h"#include "axesScale.h"#include "BasicAlgos.h"#include "sciprint.h"#include "Format.h"#include "periScreen.h"#include "CurrentObjectsManagement.h"#include "MALLOC.h"Include dependency graph for Plo3d.c:

Go to the source code of this file.
Defines | |
| #define | PGEOX(x1, y1, z1) inint(xx1= Cscale.Wscx1*(TRX(x1,y1,z1)-Cscale.frect[0]) +Cscale.Wxofset1); |
| #define | PGEOY(x1, y1, z1) inint(yy1= Cscale.Wscy1*(-TRY(x1,y1,z1)+Cscale.frect[3])+Cscale.Wyofset1); |
Functions | |
| void wininfo | __PARAMS ((char *fmt,...)) |
| double C2F() | dsort () |
| char | GetDriver (void) |
| int | Check3DPlots (char *, integer *) |
| int | scilab_shade (integer *polyx, integer *polyy, integer *fill, integer polysize, integer flag) |
| static void dbox | __PARAMS ((void)) |
| int C2F() | box3d (double *xbox, double *ybox, double *zbox) |
| void | SetEch3d1 (double *xbox, double *ybox, double *zbox, double *bbox, double *teta, double *alpha, integer flag) |
| void | UpNext (integer ind1, integer *ind2, integer *ind3) |
| void | DownNext (integer ind1, integer *ind2, integer *ind3) |
| void | Convex_Box (double *xbox, double *ybox, integer *InsideU, integer *InsideD, char *legend, integer *flag, double *bbox) |
| void C2F() | TDdrawaxis (double size, double FPval, double LPval, integer *nax, integer *FPoint, integer *LPoint, integer *Ticsdir) |
| void | TDAxis (integer flag, double FPval, double LPval, integer *nax, integer *FPoint, integer *LPoint, integer *Ticsdir) |
| void | AxesStrings (integer axflag, integer *ixbox, integer *iybox, integer *xind, char *legend, double *bbox) |
| void | BBoxToval (double *x, double *y, double *z, integer ind, double bbox[6]) |
| int | I3dRotation (void) |
| static void | dbox (void) |
| int | triangleSort (integer *polyxin, integer *polyyin, integer *fillin, integer *polyx, integer *polyy, integer *fill) |
Variables | |
| static double | theta |
| static double | alpha |
| #define PGEOX | ( | x1, | |||
| y1, | |||||
| z1 | ) | inint(xx1= Cscale.Wscx1*(TRX(x1,y1,z1)-Cscale.frect[0]) +Cscale.Wxofset1); |
| #define PGEOY | ( | x1, | |||
| y1, | |||||
| z1 | ) | inint(yy1= Cscale.Wscy1*(-TRY(x1,y1,z1)+Cscale.frect[3])+Cscale.Wyofset1); |
| static void dbox __PARAMS | ( | (void) | ) | [static] |
| void wininfo __PARAMS | ( | (char *fmt,...) | ) |
| void AxesStrings | ( | integer | axflag, | |
| integer * | ixbox, | |||
| integer * | iybox, | |||
| integer * | xind, | |||
| char * | legend, | |||
| double * | bbox | |||
| ) |
xind : indices des points de l'enveloppe cvxe ds xbox et ybox
le cot\'e gauche ( c'est tjrs un axe des Z
le cot\^e en bas \`a gauche
le cot\'e en bas a droite
Definition at line 453 of file Plo3d.c.
References BBoxToval(), C2F, dr(), FREE, inint, L, MALLOC, NULL, PD0, PI0, sciprint(), TDAxis(), x, and y.
Referenced by Convex_Box().
00454 { 00455 integer verbose=0,narg_,xz[2]; 00456 integer iof; 00457 char *loc = NULL; 00458 /* char * buff = NULL; */ 00459 char * legx = NULL; 00460 char * legy = NULL; 00461 char * legz = NULL; 00462 integer rect[4],flag=0,x,y; 00463 double ang=0.0; 00464 00465 loc=(char *) MALLOC( (strlen(legend)+1)*sizeof(char)); 00466 if ( loc == NULL) 00467 { 00468 sciprint("AxesString : No more Place to store Legends\n"); 00469 return; 00470 } 00471 00472 strcpy(loc,legend); 00473 /* legx=strtok_r(loc,"@",&buff); */ 00474 /* legy=strtok_r(NULL,"@",&buff); */ 00475 /* legz=strtok_r(NULL,"@",&buff); */ 00476 00477 legx=strtok(loc,"@"); 00478 legy=strtok(NULL,"@"); 00479 legz=strtok(NULL,"@"); 00480 00482 C2F(dr)("xget","wdim",&verbose,xz,&narg_, PI0, PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00483 iof = (xz[0]+xz[1])/50; 00484 00485 x = (integer) (ixbox[2]-(xz[0]+xz[1])/20) ; 00486 y = (integer) (0.5*iybox[3]+0.5*iybox[2]); 00487 /*** le z scaling ***/ 00488 if ( axflag>=4) 00489 { 00490 double fx,fy,fz,lx,ly,lz; 00491 integer LPoint[2],FPoint[2],Ticsdir[2],xnax[2]; 00492 xnax[0]=5;xnax[1]=2; 00493 FPoint[0]=ixbox[2];FPoint[1]=iybox[2]; 00494 LPoint[0]=ixbox[3];LPoint[1]=iybox[3]; 00495 Ticsdir[0]= -1; 00496 Ticsdir[1]=0; 00497 BBoxToval(&fx,&fy,&fz,xind[2],bbox); 00498 BBoxToval(&lx,&ly,&lz,xind[3],bbox); 00499 TDAxis(1L,fz,lz,xnax,FPoint,LPoint,Ticsdir); 00500 } 00501 if (legz != NULL) 00502 { 00503 C2F(dr)("xstringl",legz,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00504 C2F(dr)("xstring",legz,(x=x - rect[2],&x),&y,PI0,&flag 00505 ,PI0,PI0,&ang,PD0,PD0,PD0,0L,0L); 00506 } 00509 x=inint((ixbox[3]+ixbox[4])/2.0 -iof); 00510 y=inint((1/3.0)*iybox[3]+(2/3.0)*iybox[4]+(xz[0]+xz[1])/30); 00511 00512 if ( xind[3]+xind[4] == 3) 00513 { 00514 if ( axflag>=4) 00515 { 00516 double fx,fy,fz,lx,ly,lz; 00517 integer LPoint[2],FPoint[2],Ticsdir[2],xnax[2]; 00518 xnax[0]=5;xnax[1]=2; 00519 FPoint[0]=ixbox[3];FPoint[1]=iybox[3]; 00520 LPoint[0]=ixbox[4];LPoint[1]=iybox[4]; 00521 Ticsdir[0]=ixbox[4]-ixbox[5]; 00522 Ticsdir[1]=iybox[4]-iybox[5]; 00523 BBoxToval(&fx,&fy,&fz,xind[3],bbox); 00524 BBoxToval(&lx,&ly,&lz,xind[4],bbox); 00525 TDAxis(2L,fx,lx,xnax,FPoint,LPoint,Ticsdir); 00526 } 00527 if (legx != NULL) 00528 { 00529 00530 C2F(dr)("xstringl",legx,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00531 C2F(dr)("xstring",legx,(x=x-rect[2],&x),&y,PI0,&flag 00532 ,PI0,PI0,&ang,PD0,PD0,PD0,0L,0L); 00533 } 00534 } 00535 else 00536 { 00537 if ( axflag>=4) 00538 { 00539 double fx,fy,fz,lx,ly,lz; 00540 integer LPoint[2],FPoint[2],Ticsdir[2],xnax[2]; 00541 xnax[0]=5;xnax[1]=2; 00542 FPoint[0]=ixbox[3];FPoint[1]=iybox[3]; 00543 LPoint[0]=ixbox[4];LPoint[1]=iybox[4]; 00544 Ticsdir[0]=ixbox[4]-ixbox[5]; 00545 Ticsdir[1]=iybox[4]-iybox[5]; 00546 BBoxToval(&fx,&fy,&fz,xind[3],bbox); 00547 BBoxToval(&lx,&ly,&lz,xind[4],bbox); 00548 TDAxis(2L,fy,ly,xnax,FPoint,LPoint,Ticsdir); 00549 } 00550 if (legy != NULL) 00551 { 00552 00553 C2F(dr)("xstringl",legy,&x,&y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00554 C2F(dr)("xstring",legy,(x=x-rect[2],&x),&y,PI0,&flag 00555 ,PI0,PI0,&ang,PD0,PD0,PD0,0L,0L); 00556 } 00557 } 00560 x=inint((ixbox[4]+ixbox[5])/2+(xz[0]+xz[1])/30); 00561 y=inint(((2/3.0)*iybox[4]+(1/3.0)*iybox[5])+iof); 00562 00563 if ( xind[4]+xind[5] == 3) 00564 { 00565 if ( axflag>=4) 00566 { 00567 double fx,fy,fz,lx,ly,lz; 00568 integer LPoint[2],FPoint[2],Ticsdir[2],xnax[2]; 00569 xnax[0]=5;xnax[1]=2; 00570 FPoint[0]=ixbox[4];FPoint[1]=iybox[4]; 00571 LPoint[0]=ixbox[5];LPoint[1]=iybox[5]; 00572 Ticsdir[0]=ixbox[4]-ixbox[3]; 00573 Ticsdir[1]=iybox[4]-iybox[3]; 00574 BBoxToval(&fx,&fy,&fz,xind[4],bbox); 00575 BBoxToval(&lx,&ly,&lz,xind[5],bbox); 00576 TDAxis(3L,fx,lx,xnax,FPoint,LPoint,Ticsdir); 00577 } 00578 if (legx != NULL) 00579 { 00580 C2F(dr)("xstring",legx,&x,&y,PI0,&flag,PI0,PI0,&ang,PD0,PD0,PD0,0L,0L); 00581 } 00582 } 00583 else 00584 { 00585 if ( axflag>=4) 00586 { 00587 double fx,fy,fz,lx,ly,lz; 00588 integer LPoint[2],FPoint[2],Ticsdir[2],xnax[2]; 00589 xnax[0]=5;xnax[1]=2; 00590 FPoint[0]=ixbox[4];FPoint[1]=iybox[4]; 00591 LPoint[0]=ixbox[5];LPoint[1]=iybox[5]; 00592 Ticsdir[0]=ixbox[4]-ixbox[3]; 00593 Ticsdir[1]=iybox[4]-iybox[3]; 00594 BBoxToval(&fx,&fy,&fz,xind[4],bbox); 00595 BBoxToval(&lx,&ly,&lz,xind[5],bbox); 00596 TDAxis(3L,fy,ly,xnax,FPoint,LPoint,Ticsdir); 00597 } 00598 if (legy != NULL) 00599 { 00600 C2F(dr)("xstring",legy,&x,&y,PI0,&flag,PI0,PI0,&ang,PD0,PD0,PD0,0L,0L); 00601 } 00602 } 00603 FREE(loc); 00604 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void BBoxToval | ( | double * | x, | |
| double * | y, | |||
| double * | z, | |||
| integer | ind, | |||
| double | bbox[6] | |||
| ) |
Returns the [x,y,z] values of a pointeger given its xbox or ybox indices
Definition at line 609 of file Plo3d.c.
Referenced by AxesStrings().
00610 { 00611 switch ( ind) 00612 { 00613 case 0: *x=bbox[0],*y=bbox[2],*z=bbox[4];break; 00614 case 1: *x=bbox[0],*y=bbox[3],*z=bbox[4];break; 00615 case 2: *x=bbox[1],*y=bbox[3],*z=bbox[4];break; 00616 case 3: *x=bbox[1],*y=bbox[2],*z=bbox[4];break; 00617 case 4: *x=bbox[0],*y=bbox[2],*z=bbox[5];break; 00618 case 5: *x=bbox[0],*y=bbox[3],*z=bbox[5];break; 00619 case 6: *x=bbox[1],*y=bbox[3],*z=bbox[5];break; 00620 case 7: *x=bbox[1],*y=bbox[2],*z=bbox[5];break; 00621 } 00622 }
Here is the caller graph for this function:

| int C2F() box3d | ( | double * | xbox, | |
| double * | ybox, | |||
| double * | zbox | |||
| ) |
Definition at line 43 of file Plo3d.c.
References wcscalelist::bbox1, C2F, Convex_Box(), Cscale, dr(), DrawAxis(), FREE, getStrMatElement(), L, m, MALLOC, sciSubWindow::mon_x_label, sciSubWindow::mon_y_label, sciSubWindow::mon_z_label, n, NULL, PD0, PI0, pSUBWIN_FEATURE, sciGetCurrentSubWin(), sciGetText(), sciprint(), XScale(), and YScale().
Referenced by dbox(), and zoom_box().
00044 { 00045 00046 static integer InsideU[4],InsideD[4],flag[]={1,1,3}; 00047 static integer ixbox[4],iybox[4], n=2, m=1; 00048 char * legends = NULL; 00049 sciPointObj * psubwin = NULL; 00050 sciSubWindow * ppsubwin = NULL; 00051 00052 char * legx = NULL; 00053 char * legy = NULL; 00054 char * legz = NULL; 00060 psubwin = sciGetCurrentSubWin(); 00061 ppsubwin = pSUBWIN_FEATURE (psubwin); 00062 00063 legx = getStrMatElement( sciGetText(ppsubwin->mon_x_label), 0, 0 ) ; 00064 legy = getStrMatElement( sciGetText(ppsubwin->mon_y_label), 0, 0 ) ; 00065 legz = getStrMatElement( sciGetText(ppsubwin->mon_z_label), 0, 0 ) ; 00066 00067 if ((legends = MALLOC ((strlen(legx)+ 00068 strlen(legy)+ 00069 strlen(legz)+ 00070 7)*sizeof (char))) == NULL) 00071 sciprint("box3d : No more Place to store legends (3D labels)\n"); 00072 00073 if(legx == NULL) 00074 strcpy(legends,""); 00075 else 00076 strcpy(legends,legx); 00077 00078 strcat(legends,"@"); 00079 00080 if(legy == NULL) 00081 strcat(legends,""); 00082 else 00083 strcat(legends,legy); 00084 00085 strcat(legends,"@"); 00086 00087 if(legz == NULL) 00088 strcat(legends,""); 00089 else 00090 strcat(legends,legz); 00091 00092 Convex_Box(xbox,ybox,InsideU,InsideD,legends,flag,Cscale.bbox1); 00093 FREE(legends); legends = NULL; 00094 00095 00096 C2F (dr) ("xset","thickness",&m,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00097 if (zbox[InsideU[0]] > zbox[InsideD[0]]) 00098 DrawAxis(xbox,ybox,InsideU,2); 00099 else 00100 DrawAxis(xbox,ybox,InsideD,2); 00101 if (zbox[InsideU[0]] > zbox[InsideD[0]]) 00102 DrawAxis(xbox,ybox,InsideD,2); 00103 else 00104 DrawAxis(xbox,ybox,InsideU,2); 00105 00106 ixbox[0]=XScale(xbox[0]);ixbox[1]=XScale(xbox[2]); 00107 ixbox[2]=XScale(xbox[1]);ixbox[3]=XScale(xbox[3]); 00108 iybox[0]=YScale(ybox[0]); iybox[1]=YScale(ybox[2]); 00109 iybox[2]=YScale(ybox[1]); iybox[3]=YScale(ybox[3]); 00110 C2F(dr)("xpolys","v",ixbox,iybox,&n,&m,&n,PI0,PD0,PD0,PD0,PD0,0L,0L); 00111 C2F(dr)("xpolys","v",ixbox+2,iybox+2,&n,&m,&n,PI0,PD0,PD0,PD0,PD0,0L,0L); 00112 00113 00114 00115 return(0); 00116 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Convex_Box | ( | double * | xbox, | |
| double * | ybox, | |||
| integer * | InsideU, | |||
| integer * | InsideD, | |||
| char * | legend, | |||
| integer * | flag, | |||
| double * | bbox | |||
| ) |
Definition at line 275 of file Plo3d.c.
References AxesStrings(), C2F, DownNext(), dr(), i, ind, j, L, Maxi(), MaxiInd(), n, p, PD0, PI0, sciprint(), UpNext(), XScale(), and YScale().
00276 { 00277 double xmaxi; 00278 integer ixbox[8],iybox[8]; 00279 integer xind[8]; 00280 integer ind2,ind3,ind; 00281 integer p,n,dvect[1],dash[6]; 00282 integer verbose=0,narg_,pat; 00283 integer i,j; 00290 /* 4 ----- 5 */ 00291 /* / /| */ 00292 /* 7----6 | */ 00293 /* | 0 | / 1 */ 00294 /* 3----- 2 */ 00298 xmaxi=((double) Maxi(xbox,8L)); 00299 ind= -1; 00300 for (i =0 ; i < 8 ; i++) 00301 { 00302 MaxiInd(xbox,8L,&ind,xmaxi); 00303 if ( ind > 3) 00304 { 00305 xind[0]=ind; 00306 break; 00307 } 00308 } 00309 if (ind < 0 || ind > 8) 00310 { 00311 sciprint("xind out of bounds"); 00312 xind[0]=0; 00313 } 00314 UpNext(xind[0],&ind2,&ind3); 00315 if (ybox[ind2] > ybox[ind3]) 00316 { 00317 xind[1]=ind2;InsideU[0]=ind3; 00318 } 00319 else 00320 { 00321 xind[1]=ind3;InsideU[0]=ind2; 00322 } 00323 UpNext(ind2,&ind2,&ind3); InsideU[1]=xind[0]; 00324 InsideU[2]=ind2; InsideU[3]=InsideU[0]-4; 00325 xind[2]=ind2; 00326 /* le pointeger en bas qui correspond */ 00327 xind[3]=ind2-4; 00328 DownNext(xind[3],&ind2,&ind3); 00329 if (ybox[ind2] < ybox[ind3]) 00330 { 00331 xind[4]=ind2;InsideD[0]=ind3; 00332 } 00333 else 00334 { 00335 xind[4]=ind3;InsideD[0]=ind2; 00336 } 00337 DownNext(ind2,&ind2,&ind3); 00338 InsideD[1]=xind[3]; 00339 InsideD[2]=ind2; 00340 InsideD[3]=InsideD[0]+4; 00341 xind[5]=ind2; 00342 for (i=0; i < 6 ; i++) 00343 { 00344 ixbox[i]=XScale(xbox[xind[i]]); 00345 iybox[i]=YScale(ybox[xind[i]]); 00346 } 00347 ixbox[6]=ixbox[0];iybox[6]=iybox[0]; 00348 p=7,n=1; 00351 dvect[0]=2; 00353 C2F(dr)("xget","line style",&verbose,dash,&narg_,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00354 C2F(dr)("xset","line style",(j=1,&j),PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00355 C2F (dr) ("xset","thickness",(j=1,&j),PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00356 if (flag[2]>=3){ 00357 C2F(dr)("xpolys","v",ixbox,iybox,dvect,&n,&p 00358 ,PI0,PD0,PD0,PD0,PD0,0L,0L); 00359 } 00360 C2F(dr)("xget","pattern",&verbose,&pat,&narg_,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00361 C2F(dr)("xset","pattern",dvect,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00362 if (flag[2]>=3) 00363 AxesStrings(flag[2],ixbox,iybox,xind,legend,bbox); 00364 C2F(dr)("xset","pattern",&pat,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00365 C2F(dr)("xset","line style",dash,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00366 00367 }
Here is the call graph for this function:

| static void dbox | ( | void | ) | [static] |
Definition at line 797 of file Plo3d.c.
References box3d(), C2F, dr(), L, PD0, and PI0.
Referenced by axis_3ddraw(), and I3dRotation().
00798 { 00799 double xbox[8],ybox[8],zbox[8]; 00800 #ifdef _MSC_VER 00801 integer verbose_=0,pat,pat1=3,narg_,un=1; 00802 C2F(dr)("xget","pattern",&verbose_,&pat,&narg_,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00803 C2F(dr)("xset","pattern",&pat1,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00804 C2F (dr) ("xset", "line style",&un,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00805 #endif 00806 SetEch3d1(xbox,ybox,zbox,Cscale.bbox1,&theta,&alpha,Cscale.metric3d); 00807 C2F(box3d)(xbox,ybox,zbox); 00808 #ifdef _MSC_VER 00809 C2F(dr)("xset","pattern",&pat,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00810 #endif 00811 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 261 of file Plo3d.c.
Referenced by Convex_Box().
00262 { 00263 *ind2 = ind1+1; 00264 *ind3 = ind1-1; 00265 if (*ind2 == 4) *ind2 = 0; 00266 if (*ind3 == -1) *ind3 = 3; 00267 }
Here is the caller graph for this function:

| double C2F() dsort | ( | ) |
| char GetDriver | ( | void | ) |
| int I3dRotation | ( | void | ) |
Definition at line 631 of file Plo3d.c.
References Abs, wcscalelist::alpha, sciSubWindow::axes, wcscalelist::bbox1, C2F, CheckClickedSubwin(), Cscale, sciSubWindow::cube_scaling, dbox(), dr(), dr1(), echelle2d(), AXES::flag, wcscalelist::frect, sciSubWindow::FRect, int, sciSubWindow::is3d, L, long, wcscalelist::metric3d, NULL, Obj_RedrawNewAngle(), PD0, pFIGURE_FEATURE, PI0, tagSons::pnext, tagSons::pointobj, pSUBWIN_FEATURE, ReleaseWinHdc(), SCI_SUBWIN, sciGetCurrentFigure(), sciGetCurrentSubWin(), sciGetEntityType(), sciGetLastSons(), sciGetSons(), SciMouseCapture(), SciMouseRelease(), sciRedrawFigure(), sciSetSelectedSubWin(), SetWinhdc(), wcscalelist::theta, TRUE, wininfo(), x, xr, y, and yr.
Referenced by scig_3drot().
00632 { 00633 integer pixmode,alumode,verbose=0,narg_,ww; 00634 double xx,yy; 00635 double theta0,alpha0; 00636 static int one=1; 00637 00638 static integer modes[]={1,0};/* for xgemouse only get mouse mouvement*/ 00639 sciSons *psonstmp; 00640 sciPointObj *psubwin, *tmpsubwin; 00641 sciPointObj *pold = NULL; 00642 /* sciPointObj *psurface; */ 00643 integer xr, yr; 00644 00645 00646 integer ibutton,in,iwait=0,istr=0; 00647 integer verbose_=0,ww_; 00648 double x0,yy0,x,y,xl,yl ; 00649 00650 C2F(dr1)("xget","window",&verbose,&ww,&narg_,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00651 00653 C2F(dr)("xget","pixmap",&verbose,&pixmode,&narg_,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00654 C2F(dr)("xget","alufunction",&verbose,&alumode,&narg_,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00655 00656 00657 #ifdef _MSC_VER 00658 SetWinhdc(); 00659 SciMouseCapture(); 00660 #endif 00661 C2F(dr)("xclick","one",&ibutton,&xr,&yr,&iwait,&istr,PI0,PD0,PD0,PD0,PD0,0L,0L); 00662 #ifdef _MSC_VER 00663 ReleaseWinHdc(); 00664 SciMouseRelease(); 00665 #endif 00666 theta=Cscale.theta ; 00667 alpha=Cscale.alpha ; 00668 theta0=theta; 00669 alpha0=alpha; 00670 00671 ibutton=-1; 00672 tmpsubwin = sciGetCurrentSubWin() ; 00673 if ( pFIGURE_FEATURE(sciGetCurrentFigure())->rotstyle == 0) 00674 { 00675 psubwin = CheckClickedSubwin(xr,yr); 00677 if( psubwin != NULL ) 00678 { 00679 sciSubWindow * ppSubWin = pSUBWIN_FEATURE(psubwin) ; 00680 sciSetSelectedSubWin (psubwin); 00681 00682 theta0 = ppSubWin-> theta; 00683 alpha0 = ppSubWin-> alpha; 00684 ppSubWin->is3d = TRUE; 00685 Cscale.metric3d = (long)(ppSubWin->axes.flag[1]+1)/2; 00686 00687 /* Modif. HERE F.Leray 24.05.04 : we take advantage of update_specification_bounds and update_3dbounds previous call */ 00688 /* brect variable should not exist any more.*/ 00689 Cscale.bbox1[0] = ppSubWin->FRect[0]; 00690 Cscale.bbox1[1] = ppSubWin->FRect[2]; 00691 Cscale.bbox1[2] = ppSubWin->FRect[1]; 00692 Cscale.bbox1[3] = ppSubWin->FRect[3]; 00693 Cscale.bbox1[4] = ppSubWin->FRect[4]; 00694 Cscale.bbox1[5] = ppSubWin->FRect[5]; 00695 00696 if( ppSubWin->cube_scaling ) 00697 { 00698 Cscale.bbox1[0] = 0.; 00699 Cscale.bbox1[1] = 1.; 00700 Cscale.bbox1[2] = 0.; 00701 Cscale.bbox1[3] = 1.; 00702 Cscale.bbox1[4] = 0.; 00703 Cscale.bbox1[5] = 1.; 00704 } 00705 } 00706 else 00707 { 00708 wininfo("No 3d object selected"); 00709 return 0; 00710 } 00711 } 00712 else 00713 { 00714 psonstmp = sciGetLastSons (sciGetCurrentFigure()); 00715 while (psonstmp != (sciSons *) NULL) 00716 { 00717 if(sciGetEntityType (psonstmp->pointobj) == SCI_SUBWIN) 00718 break; 00719 psonstmp = psonstmp->pnext; 00720 } 00721 sciSetSelectedSubWin (psonstmp->pointobj); 00722 } 00723 xx=1.0/Abs(Cscale.frect[0]-Cscale.frect[2]); 00724 yy=1.0/Abs(Cscale.frect[1]-Cscale.frect[3]); 00725 00726 C2F(echelle2d)(&x0,&yy0,&xr,&yr,&one,&one,"i2f",3L); 00727 x0=(x0-Cscale.frect[0])*xx; 00728 yy0=(yy0-Cscale.frect[1])*yy; 00729 x=x0;y=yy0; 00730 00731 #ifdef _MSC_VER 00732 SetWinhdc(); 00733 SciMouseCapture(); 00734 #endif 00735 00736 if ( pixmode == 0 ) C2F(dr1)("xset","alufunction",(in=6,&in),PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00737 00738 while ( ibutton == -1 ) 00739 { 00740 /* dessin d'un rectangle */ 00741 theta= ((int)(theta0 - 180.0*(x-x0)) % 360); 00742 alpha= ((int)(alpha0 + 180.0*(y-yy0)) % 360); 00743 wininfo("alpha=%.1f,theta=%.1f",alpha,theta); 00744 if ( pixmode == 1) C2F(dr1)("xset","wwpc",PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00745 dbox(); 00746 if ( pixmode == 1) C2F(dr1)("xset","wshow",PI0,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00747 C2F(dr1)("xgetmouse","one",&ibutton,&iwait,PI0,PI0,modes,PI0,&xl, &yl,PD0,PD0,0L,0L); 00748 if (ibutton==-100) return 1;/* window has been closed */ 00749 /* effacement du rectangle */ 00750 dbox(); 00751 xx=1.0/Abs(Cscale.frect[0]-Cscale.frect[2]); 00752 yy=1.0/Abs(Cscale.frect[1]-Cscale.frect[3]); 00753 x=(xl-Cscale.frect[0])*xx; 00754 y=(yl-Cscale.frect[1])*yy; 00755 } 00756 if ( pixmode == 0) C2F(dr1)("xset","alufunction",(in=3,&in),PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00757 C2F(dr1)("xget","window",&verbose_,&ww_,&narg_,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00758 C2F(dr1)("xset","alufunction",&alumode,PI0,PI0,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00759 #ifdef _MSC_VER 00760 ReleaseWinHdc(); 00761 SciMouseRelease(); 00762 #endif 00763 00764 if (pFIGURE_FEATURE((sciPointObj *)sciGetCurrentFigure())->rotstyle == 0){ 00765 pold = sciGetCurrentSubWin(); 00766 sciSetSelectedSubWin(psubwin); 00767 Obj_RedrawNewAngle(psubwin,theta,alpha); 00768 sciSetSelectedSubWin(pold); 00769 } 00770 else 00771 { 00772 psonstmp = sciGetSons (sciGetCurrentFigure()); 00773 while (psonstmp != (sciSons *) NULL) 00774 { 00775 if(sciGetEntityType (psonstmp->pointobj) == SCI_SUBWIN){ 00776 pold = sciGetCurrentSubWin(); 00777 sciSetSelectedSubWin(psonstmp->pointobj); 00778 Obj_RedrawNewAngle(psonstmp->pointobj,theta,alpha); 00779 sciSetSelectedSubWin(pold); 00780 } 00781 psonstmp = psonstmp->pnext; 00782 } 00783 } 00784 sciRedrawFigure(); 00785 wininfo("alpha=%.1f,theta=%.1f",alpha,theta); 00786 sciSetSelectedSubWin (tmpsubwin); 00787 return 0; 00788 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int scilab_shade | ( | integer * | polyx, | |
| integer * | polyy, | |||
| integer * | fill, | |||
| integer | polysize, | |||
| integer | flag | |||
| ) |
| void SetEch3d1 | ( | double * | xbox, | |
| double * | ybox, | |||
| double * | zbox, | |||
| double * | bbox, | |||
| double * | teta, | |||
| double * | alpha, | |||
| integer | flag | |||
| ) |
Definition at line 128 of file Plo3d.c.
References wcscalelist::alpha, Alpha, wcscalelist::bbox1, C2F, cost, Cscale, dr(), dx, dy, getscale2d(), hmax, ib, L, linint, wcscalelist::m, M_PI, Maxi(), wcscalelist::metric3d, Mini(), NULL, PD0, PI0, R, set_scale(), sint, wcscalelist::theta, TRX, TRY, and TRZ.
00129 { 00130 double xmmin,ymmax,xmmax,ymmin,FRect[4],WRect[4],ARect[4]; 00131 integer ib; 00132 static integer aaint[]={2,10,2,10}; 00133 int verbose=0,wdim[2],narg_; 00134 char logf_[2]; 00135 double R,xo,yo,zo,dx,dy,dz,hx,hy,hx1,hy1,Teta,Alpha; 00136 integer wmax,hmax; 00137 static double cost=0.5,sint=0.5,cosa=0.5,sina=0.5; 00138 Teta=*teta; 00139 Alpha=*alpha; 00140 /* if (flag==0) { 00141 Alpha=Cscale.alpha; 00142 Teta=Cscale.theta; 00143 } 00144 else { 00145 Cscale.alpha = Alpha; 00146 Cscale.theta = Teta; 00147 }*/ 00148 Cscale.alpha = Alpha; 00149 Cscale.theta = Teta; 00150 cost=cos((Teta)*M_PI/180.0); 00151 sint=sin((Teta)*M_PI/180.0); 00152 cosa=cos((Alpha)*M_PI/180.0); 00153 sina=sin((Alpha)*M_PI/180.0); 00154 Cscale.m[0][0]= -sint ; Cscale.m[0][1]= cost ; Cscale.m[0][2]= 0; 00155 Cscale.m[1][0]= -cost*cosa; Cscale.m[1][1]= -sint*cosa; Cscale.m[1][2]= sina; 00156 Cscale.m[2][0]= cost*sina; Cscale.m[2][1]= sint*sina; Cscale.m[2][2]= cosa; 00157 /* Coordonn\'ees apr\`es transformation g\'eometrique de la 00158 * boite qui entoure le plot3d 00159 * le plan de projection est defini par x et y 00160 */ 00161 for (ib=0;ib<6 ;ib++) 00162 { 00163 if (flag==0) 00164 bbox[ib]=Cscale.bbox1[ib]; 00165 else 00166 Cscale.bbox1[ib]=bbox[ib]; 00167 } 00168 xbox[0]=TRX(bbox[0],bbox[2],bbox[4]); 00169 ybox[0]=TRY(bbox[0],bbox[2],bbox[4]); 00170 zbox[0]=TRZ(bbox[0],bbox[2],bbox[4]); 00171 xbox[1]=TRX(bbox[0],bbox[3],bbox[4]); 00172 ybox[1]=TRY(bbox[0],bbox[3],bbox[4]); 00173 zbox[1]=TRZ(bbox[0],bbox[3],bbox[4]); 00174 xbox[2]=TRX(bbox[1],bbox[3],bbox[4]); 00175 ybox[2]=TRY(bbox[1],bbox[3],bbox[4]); 00176 zbox[2]=TRZ(bbox[1],bbox[3],bbox[4]); 00177 xbox[3]=TRX(bbox[1],bbox[2],bbox[4]); 00178 ybox[3]=TRY(bbox[1],bbox[2],bbox[4]); 00179 zbox[3]=TRZ(bbox[1],bbox[2],bbox[4]); 00180 xbox[4]=TRX(bbox[0],bbox[2],bbox[5]); 00181 ybox[4]=TRY(bbox[0],bbox[2],bbox[5]); 00182 zbox[4]=TRZ(bbox[0],bbox[2],bbox[5]); 00183 xbox[5]=TRX(bbox[0],bbox[3],bbox[5]); 00184 ybox[5]=TRY(bbox[0],bbox[3],bbox[5]); 00185 zbox[5]=TRZ(bbox[0],bbox[3],bbox[5]); 00186 xbox[6]=TRX(bbox[1],bbox[3],bbox[5]); 00187 ybox[6]=TRY(bbox[1],bbox[3],bbox[5]); 00188 zbox[6]=TRZ(bbox[1],bbox[3],bbox[5]); 00189 xbox[7]=TRX(bbox[1],bbox[2],bbox[5]); 00190 ybox[7]=TRY(bbox[1],bbox[2],bbox[5]); 00191 zbox[7]=TRZ(bbox[1],bbox[2],bbox[5]); 00193 if ( flag == 1 || flag == 3 ) 00194 { 00195 xmmin= (double) Mini(xbox,8L);xmmax= (double) Maxi(xbox,8L); 00196 ymmax= (double) - Mini(ybox,8L); 00197 ymmin= (double) - Maxi(ybox,8L); 00198 } 00199 /* code added by es: isoview scaling */ 00200 if ( flag == 2 || flag == 3 ) 00201 { 00202 /* get current window size */ 00203 C2F(dr)("xget","wdim",&verbose,wdim,&narg_, PI0,PI0,PI0, 00204 PD0,PD0,PD0,PD0,0L,0L); 00205 getscale2d(WRect,FRect,logf_,ARect); 00206 wmax=linint((double)wdim[0] * WRect[2]); 00207 hmax=linint((double)wdim[1] * WRect[3]); 00208 } 00209 if ( flag == 2 ) 00210 { 00211 /* radius and center of the sphere circumscribing the box */ 00212 dx=bbox[1]-bbox[0]; dy=bbox[3]-bbox[2]; dz=bbox[5]-bbox[4]; 00213 R= (double) sqrt(dx*dx + dy*dy + dz*dz)/2; 00214 xo= (double) (xbox[0]+xbox[6])/2 ; 00215 yo= (double) (ybox[0]+ybox[6])/2 ; 00216 zo= (double) (zbox[0]+zbox[6])/2 ; 00217 xmmin= (double) xo - R ; 00218 xmmax= (double) xo + R ; 00219 ymmax= (double) -yo + R ; 00220 ymmin= (double) -yo - R ; 00221 } 00222 if (flag==2 || flag==3) 00223 { 00224 /* adjust limits (code adapted from Plo2d.c & Stephane's patch) */ 00225 hx=xmmax-xmmin; 00226 hy=ymmax-ymmin; 00227 if ( hx/(double)wmax < hy/(double)hmax ) 00228 { 00229 hx1=wmax*hy/hmax; 00230 xmmin=xmmin-(hx1-hx)/2.0; 00231 xmmax=xmmax+(hx1-hx)/2.0; 00232 } 00233 else 00234 { 00235 hy1=hmax*hx/wmax; 00236 ymmin=ymmin-(hy1-hy)/2.0; 00237 ymmax=ymmax+(hy1-hy)/2.0; 00238 } 00239 } 00240 if (flag !=0 ) 00241 { 00242 FRect[0]=xmmin;FRect[1]= -ymmax;FRect[2]=xmmax;FRect[3]= -ymmin; 00243 set_scale("tftttf",NULL,FRect,aaint,"nn",NULL); 00244 Cscale.metric3d=flag; /* the metric mode is stored into the 00245 * List of Scales */ 00246 } 00247 /* end of code added by es */ 00248 }
Here is the call graph for this function:

| void TDAxis | ( | integer | flag, | |
| double | FPval, | |||
| double | LPval, | |||
| integer * | nax, | |||
| integer * | FPoint, | |||
| integer * | LPoint, | |||
| integer * | Ticsdir | |||
| ) |
Definition at line 398 of file Plo3d.c.
References Abs, C2F, ChoixFormatE(), dr(), dx, dy, foo(), i, inint, L, lp, Max, Min, PD0, PI0, and TDdrawaxis().
Referenced by AxesStrings().
00399 { 00400 char fornum[100]; 00401 integer i,barlength; 00402 double xp, dx,dy,ticsx,ticsy,size; 00403 integer verbose=0,narg_,xz[2]; 00404 C2F(dr)("xget","wdim",&verbose,xz,&narg_, PI0, PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00405 size = xz[0]>=xz[1] ? xz[1]/50.0 : xz[0]/50.0; 00406 C2F(TDdrawaxis)(size,FPval,LPval,nax,FPoint,LPoint,Ticsdir) ; 00407 ChoixFormatE(fornum,Min(FPval,LPval),Max(LPval,FPval), 00408 Abs((LPval-FPval))/nax[1]); 00409 xp= FPval; 00410 barlength=inint(1.2*size); 00411 dx= ((double) LPoint[0]-FPoint[0])/((double)nax[1]); 00412 dy= ((double) LPoint[1]-FPoint[1])/((double)nax[1]); 00413 if ( Ticsdir[0] == 0 && Ticsdir[1] == 0) 00414 { 00415 ticsx= ticsy = 0; 00416 } 00417 else 00418 { 00419 ticsx= barlength*( Ticsdir[0])/ 00420 sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1]); 00421 ticsy= barlength*( Ticsdir[1])/ 00422 sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1]); 00423 } 00424 for (i=0; i <= nax[1];i++) 00425 { double angle=0.0; 00426 integer flag1=0; 00427 integer xx=0,yy=0, posi[2],rect[4]; 00428 char foo[100];/*** JPC : must be cleared properly **/ 00429 double lp; 00430 lp = xp + i*(LPval-FPval)/((double)nax[1]); 00431 sprintf(foo,fornum,lp); 00432 C2F(dr)("xstringl",foo,&xx,&yy,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L); 00433 posi[0]=inint(FPoint[0]+ i*dx + 2*ticsx ); 00434 posi[1]=inint(FPoint[1]+ i*dy + 2*ticsy +rect[3]/2 ); 00435 switch ( flag) 00436 { 00437 case 1: posi[0] -= rect[2]; 00439 if ( i== nax[1]) posi[1] -= rect[3]/2; 00440 break; 00441 case 2: posi[0] -= rect[2];break; 00442 } 00443 C2F(dr)("xstring",foo,&(posi[0]),&(posi[1]),PI0,&flag1,PI0,PI0,&angle,PD0,PD0,PD0,0L,0L); 00444 } 00445 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void C2F() TDdrawaxis | ( | double | size, | |
| double | FPval, | |||
| double | LPval, | |||
| integer * | nax, | |||
| integer * | FPoint, | |||
| integer * | LPoint, | |||
| integer * | Ticsdir | |||
| ) |
Definition at line 369 of file Plo3d.c.
References C2F, dr(), dx, dy, i, iflag, L, linint, PD0, PI0, style, x, and y.
Referenced by TDAxis().
00370 { 00371 integer i; 00372 double dx,dy,ticsx,ticsy; 00373 dx= ((double) LPoint[0]-FPoint[0])/((double)nax[1]*nax[0]); 00374 dy= ((double) LPoint[1]-FPoint[1])/((double)nax[1]*nax[0]); 00375 if ( Ticsdir[0] == 0 && Ticsdir[1] == 0) 00376 { 00377 ticsx= ticsy = 0; 00378 } 00379 else 00380 { 00381 ticsx= ( Ticsdir[0])/ 00382 sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1]); 00383 ticsy= ( Ticsdir[1])/ 00384 sqrt((double) Ticsdir[0]*Ticsdir[0]+Ticsdir[1]*Ticsdir[1]); 00385 } 00386 for (i=0; i <= nax[1]*nax[0];i++) 00387 { 00388 integer siz=2,x[2],y[2],iflag=0,style=0; 00389 x[0] =linint(FPoint[0]+ ((double)i)*dx ); 00390 y[0] =linint(FPoint[1]+ ((double)i)*dy ); 00391 x[1] =linint(x[0]+ ticsx*size); 00392 y[1] =linint(y[0]+ ticsy*size); 00393 C2F(dr)("xsegs","v",x,y,&siz,&style,&iflag,PI0,PD0,PD0,PD0,PD0,0L,0L); 00394 } 00395 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int triangleSort | ( | integer * | polyxin, | |
| integer * | polyyin, | |||
| integer * | fillin, | |||
| integer * | polyx, | |||
| integer * | polyy, | |||
| integer * | fill | |||
| ) |
Definition at line 817 of file Plo3d.c.
References Abs.
Referenced by scilab_shade().
00818 { 00819 integer tmp,k; 00820 for (k=0;k<3;k++) {polyx[k]=polyxin[k]; polyy[k]=polyyin[k]; fill[k]=Abs(fillin[k]);} 00821 00822 if (fill[0]<fill[1]) { 00823 tmp=fill[0]; fill[0]=fill[1]; fill[1]=tmp; 00824 tmp=polyx[0]; polyx[0]=polyx[1]; polyx[1]=tmp; 00825 tmp=polyy[0]; polyy[0]=polyy[1]; polyy[1]=tmp; 00826 } 00827 if (fill[0]<fill[2]) { 00828 tmp=fill[0]; fill[0]=fill[2]; fill[2]=tmp; 00829 tmp=polyx[0]; polyx[0]=polyx[2]; polyx[2]=tmp; 00830 tmp=polyy[0]; polyy[0]=polyy[2]; polyy[2]=tmp; 00831 } 00832 if (fill[1]<fill[2]) { 00833 tmp=fill[1]; fill[1]=fill[2]; fill[2]=tmp; 00834 tmp=polyx[1]; polyx[1]=polyx[2]; polyx[2]=tmp; 00835 tmp=polyy[1]; polyy[1]=polyy[2]; polyy[2]=tmp; 00836 } 00837 return 0; 00838 }
Here is the caller graph for this function:

Definition at line 253 of file Plo3d.c.
Referenced by Convex_Box().
00254 { 00255 *ind2 = ind1+1; 00256 *ind3 = ind1-1; 00257 if (*ind2 == 8) *ind2 = 4; 00258 if (*ind3 == 3) *ind3 = 7; 00259 }
Here is the caller graph for this function:

double theta [static] |
Changement interactif de 3d
Definition at line 629 of file Plo3d.c.
Referenced by sci_param3d(), sci_param3d1(), sci_plot3d(), and set_rotation_angles_property().
1.5.1