PloEch.h

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------
00002  *    Graphic library
00003  *    Copyright (C) 1998-2000 Enpc/Jean-Philippe Chancelier
00004  *    jpc@cereve.enpc.fr 
00005  --------------------------------------------------------------------------*/
00006 #ifndef _SCI_ECH
00007 #define _SCI_ECH
00008 
00009 #include "ObjectStructure.h"
00010 
00011 typedef struct wcscalelist 
00012 {
00013   int flag ;                            /* zero when this is a default scale */
00014   int    wdim[2];                       /* currend windo dim in pixels */
00015   double subwin_rect[4];                /* subwindow specification */
00016   double frect[4];                      /* bounds in the <<real>> space: xmin,ymin,xmax,ymax */
00017   double axis[4];                       /* position of the axis rectangle */
00018                                         /* = [mfact_xl, mfact_xr,mfact_yu,mfact_yd]; */
00019   double xtics[4],ytics[4];             /* [xmin,ymin,nint] or [kmin,kmax,ar,nint]           */
00020   /* XXXX : c'est redondant avec aaint et quelquefois avec frect ? */
00021   double Wxofset1,Wyofset1,Wscx1,Wscy1; /* ofsets and scale factor for pixel<->double transf.*/
00022   char logflag[2];                      /* are we using logscale */
00023   integer WIRect1[4];                   /* frame bounds in pixel */
00024   integer Waaint1[4];                   /* tics and subtics numbers: [xint,xsubint,yint,ysubint] */
00025   double m[3][3];                       /* 3d geometric transformation */
00026   double bbox1[6];                      /* 3d bounds */
00027   double alpha,theta;                   /* polar coordinates of visualization point */
00028   integer metric3d;                     /* added by es - metric mode for 3d -> 2d */
00029   struct wcscalelist *next;             /* points to next one */
00030   struct wcscalelist *prev;             /* points to previous one */
00031 }  WCScaleList ;
00032 
00033 typedef struct scalelist 
00034 {
00035   WCScaleList *scales;                  /* list of Scales for window Win */
00036                                         /* one scale for each subwin */
00037   integer Win;                          /* window number */
00038   struct scalelist *next;
00039 } ScaleList ;
00040 
00041 /*
00042  * Current scale values. 
00043  */
00044 
00045 extern WCScaleList Cscale;
00046 
00047 /*
00048  * Current geometric transformation : from double to pixel 
00049  */
00050 #ifndef Min
00051 #define Min(x,y)        (((x)<(y))?(x):(y))
00052 #endif 
00053 
00054 void ShowScales( void ) ;
00055 
00056 int C2F(Nsetscale2d)( double    WRect[4],
00057                       double    ARect[4],
00058                       double    FRect[4],
00059                       char    * logscale,
00060                       integer   l1       ) ;
00061 
00062 int getscale2d( double WRect[4], double FRect[4], char * logscale, double ARect[4] ) ;
00063 
00064 void set_scale( char    flag[6]        ,
00065                 double  subwin[4]      ,
00066                 double  frame_values[4],
00067                 integer aaint[4]       ,
00068                 char    logflag[3]     ,
00069                 double  axis_values[4]  ) ;
00070 
00071 int zoom( void ) ;
00072 int zoom_box( double * bbox, int * x_pixel, int * y_pixel ) ;
00073 
00074 void unzoom( void ) ;
00075 void unzoom_one_axes( sciPointObj * psousfen ) ;
00076 
00077 extern void scizoom(double bbox[4], sciPointObj * pobj); /* INTERACTION */
00078 
00079 extern int XScale(double x);
00080 extern int XLogScale(double x);
00081 
00082 extern int YScale(double y);
00083 extern int YLogScale(double y);
00084 
00085 /* #define XScale(x)    inint( Min(Cscale.Wscx1*((x) -Cscale.frect[0]) + Cscale.Wxofset1,2147483647)) */
00086 /* #define XLogScale(x) inint( Cscale.Wscx1*(log10(x) -Cscale.frect[0]) + Cscale.Wxofset1) */
00087 /* #define YScale(y)    inint(  Min(Cscale.Wscy1*(-(y)+Cscale.frect[3]) + Cscale.Wyofset1,2147483647)) */
00088 /* #define YLogScale(y) inint( Cscale.Wscy1*(-log10(y)+Cscale.frect[3]) + Cscale.Wyofset1) */
00089 #define XDouble2Pixel(x) ((Cscale.logflag[0] == 'n') ? ( XScale(x)) : ( XLogScale(x)))
00090 #define YDouble2Pixel(y) ((Cscale.logflag[1] == 'n') ? ( YScale(y)) : ( YLogScale(y)))
00091 
00092 /* NG beg */
00093 /*
00094  * geometric transformation "for length"
00095  */
00096 #define WScale(w)   inint (Cscale.Wscx1 * (w))
00097 #define WLogScale(x,w) inint (Cscale.Wscx1 * (log10 (((x) + (w)) / (x))))
00098 #define HScale(h)   inint (Cscale.Wscy1 * (h)) 
00099 #define HLogScale(y,h) inint (Cscale.Wscy1 * (log10 ( ((y) + (h)) / (y) ) )) /* modif jb Silvy 05/2006 */
00100 #define WDouble2Pixel(x,w) ((Cscale.logflag[0] == 'n') ? ( WScale(w)) : ( WLogScale(x,w)))
00101 #define HDouble2Pixel(y,h) ((Cscale.logflag[1] == 'n') ? ( HScale(h)) : ( HLogScale(y,h)))
00102 /* NG end */
00103 
00104 /*
00105  * Current geometric transformation : from pixel to double 
00106  */
00107 
00108 /* #define XPi2R(x)  Cscale.frect[0] + (1.0/Cscale.Wscx1)*((x) - Cscale.Wxofset1) */
00109 /* #define YPi2R(y)  Cscale.frect[3] - (1.0/Cscale.Wscy1)*((y) - Cscale.Wyofset1) */
00110 
00111 
00112 /* change of frame with integer values */ 
00113 extern double XPi2R(int x);
00114 extern double YPi2R(int y);
00115 
00116 #define XPi2LogR(x)  exp10( XPi2R(x))
00117 #define YPi2LogR(y)  exp10( YPi2R(y))
00118 #define XPixel2Double(x)  (( Cscale.logflag[0] == 'l') ? XPi2LogR(x) : XPi2R(x))
00119 #define YPixel2Double(y)  (( Cscale.logflag[1] == 'l') ? YPi2LogR(y) : YPi2R(y))
00120 
00121 /* chang eof frame with double values for entries */
00122 extern double XDPi2R( double x ) ;
00123 extern double YDPi2R( double y ) ;
00124 
00125 #define XDPi2LogR(x)  exp10( XDPi2R(x))
00126 #define YDPi2LogR(y)  exp10( YDPi2R(y))
00127 #define XDPixel2Double(x)  (( Cscale.logflag[0] == 'l') ? XDPi2LogR(x) : XDPi2R(x))
00128 #define YDPixel2Double(y)  (( Cscale.logflag[1] == 'l') ? YDPi2LogR(y) : YDPi2R(y))
00129 
00130 /*
00131  * Current geometric transformation : 3D plots 
00132  */
00133 
00134 #define TRX(x1,y1,z1) ( Cscale.m[0][0]*(x1) +Cscale.m[0][1]*(y1) +Cscale.m[0][2]*(z1))
00135 #define TRY(x1,y1,z1) ( Cscale.m[1][0]*(x1) +Cscale.m[1][1]*(y1) +Cscale.m[1][2]*(z1))
00136 #define TRZ(x1,y1,z1) ( Cscale.m[2][0]*(x1) +Cscale.m[2][1]*(y1) +Cscale.m[2][2]*(z1))
00137 #define GEOX(x1,y1,z1)  XScale(TRX(x1,y1,z1))
00138 #define GEOY(x1,y1,z1)  YScale(TRY(x1,y1,z1))
00139 
00140 #define TX3D(x1,y1,z1) Cscale.Wscx1*(TRX(x1,y1,z1)-Cscale.frect[0]) +Cscale.Wxofset1 ;
00141 #define TY3D(x1,y1,z1) Cscale.Wscy1*(-TRY(x1,y1,z1)+Cscale.frect[3])+Cscale.Wyofset1 ;
00142 
00149 void getPixelCoordinates( sciPointObj * pSubWin, double coord3d[3], int pixCoord[2] ) ;
00150 
00160 int PixelWidth2d( sciPointObj * parentSubWin, double posX, double width ) ;
00161 
00171 int PixelHeight2d( sciPointObj * parentSubWin, double posY, double height ) ;
00172 
00183 void rectangleDouble2Pixel( sciPointObj * parentSubWin ,
00184                             double        ulPoint[3]   ,
00185                             double        userSize[2]  ,
00186                             int           edgesX[4]    ,
00187                             int           edgesY[4]     ) ;
00188 
00189 void Plo2d2RealToPixel(integer *n1, integer *n2, double *x, double *y, integer *xm, integer *ym, char *xf) ;
00190 void Plo2d3RealToPixel(integer *n1, integer *n2, double *x, double *y, integer *xm, integer *ym, char *xf) ;
00191 void Plo2d4RealToPixel(integer *n1, integer *n2, double *x, double *y, integer *xm, integer *ym, char *xf) ;
00192 
00193 int C2F(echelle2d)( double    x[]  ,
00194                     double    y[]  ,
00195                     integer   x1[] ,
00196                     integer   yy1[],
00197                     integer * n1   ,
00198                     integer * n2   ,
00199                     char      dir[],
00200                     integer   lstr ) ;
00201 
00202 void C2F(echelle2dl)( double    x[]  ,
00203                       double    y[]  ,
00204                       integer   x1[] ,
00205                       integer   yy1[],
00206                       integer * n1   ,
00207                       integer * n2   ,
00208                       char    * dir   ) ;
00209 
00210 void C2F(rect2d)( double x[], integer x1[], integer * n, char * dir ) ;
00211 void C2F(ellipse2d)( double x[], integer x1[], integer * n, char * dir) ;
00212 void C2F(axis2d)( double  * alpha     ,
00213                   double  * initpoint ,
00214                   double  * size      ,
00215                   integer * initpoint1,
00216                   double  * size1       ) ;
00217 
00218 int get_window_scale( integer i, double * subwin ) ;
00219 void del_window_scale( integer i ) ;
00220 
00221 void Cscale2default( void ) ;
00222 
00223 void set_window_scale_with_default( int i ) ;
00224 
00225 #endif  /* _SCI_ECH */
00226 
00227 
00228 
00229 
00230 
00231 

Generated on Sun Mar 4 15:03:49 2007 for Scilab [trunk] by  doxygen 1.5.1