home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / Programming / Source / plot3d / Plot3DView.h < prev    next >
Encoding:
Text File  |  1992-08-17  |  2.5 KB  |  88 lines

  1. /* Plot3dView.h   Copyright 1992 Steve Ludtke */
  2. #import <appkit/View.h>
  3.  
  4. #define SS .01        /* symbol size. 1.0 would cause the symbols to be */
  5.             /* as large as the view */
  6. #define MAXSETS 5    /* maximum number of sets, changing this number */
  7.             /* requires IB changes as well */
  8. #define NFN 5        /* currently this is redundant. Number of active */
  9.             /* data sets */
  10. #define TIMESTEP .1    /* Time in sec between updates */
  11.  
  12. /* 3d point structure */
  13. typedef struct {
  14.     float x,y,z;
  15. } Point;
  16.  
  17. /* data set preferences structure (incudes pointer to actual data) */
  18. typedef struct {
  19.     char sym;        /* -1 means don't plot, else 0<=sym<=6 */
  20.     NXColor color;        /* color of this set */
  21.     Point *fileData;    /* data from a file, NULL if equation mode */
  22.     Point *data;        /* data to be displayed. In file mode it */
  23.                 /* contains the visible subset of the data */
  24.     int nfdata;        /* # points in file data */
  25.     int ndata;        /* # points in data */
  26.     id expr;        /* points to the Expression (formula eval.) */
  27. } SetPref;
  28.  
  29. /* timer for spinning, etc ... */
  30. DPSTimedEntry timer;
  31. void itstime(DPSTimedEntry entry,double now,id call);
  32.  
  33. @interface Plot3DView:View
  34. {
  35. id grids;        /* number of points in x and y */
  36. id mode;        /* mouse mode selector */
  37. id controller;        /* points to PControl */
  38. float chi,theta,dchi;    /* viewing angles/speeds */
  39. float minX,maxX;    /* current min/max values */
  40. float minY,maxY;
  41. float minZ,maxZ;
  42. char pscom[1000];    /* postscript buffer for DPSUserPath */
  43. float pspath[3000];    /* increases drawing speed substantially */
  44. float psbbox[4];
  45. char zMode;        /* current value of mouse mode */
  46. int psc;        /* counter for user path */
  47. char initflag;        /* flag so timer knows the first time it's called */
  48. int Tgrids;        /* last verified value of grids */
  49. SetPref pref[MAXSETS];    /* preferences for data sets */
  50. }
  51.  
  52.  
  53. -initFrame:(NXRect *)myrect;
  54. -free;
  55.  
  56. /* rescales coord. system after size chaged */
  57. -superviewSizeChanged:(const NXSize *)oldsize;
  58.  
  59. /* draw 3d plot */
  60. -drawSelf:(NXRect *)myrect :(int)rectCount;
  61.  
  62. /* change viewing angle */
  63. -setAng:(float)chi :(float)theta;
  64.  
  65. /* used to do mouse zooming and spinning */
  66. -mouseDown:(NXEvent *)event;
  67.  
  68. /* points to controller object, usually set with IB instead */
  69. -setcontroller:del;
  70.  
  71. /* called by timer to do one time step */
  72. -step;
  73.  
  74. /* change mouse mode */
  75. -setMode:sender;
  76.  
  77. -(int)acceptsFirstMouse;
  78.  
  79. /* recalculate and display plot (and density plot, via controller) */
  80. -zoom:sender;
  81.  
  82. /* change min/max values */
  83. -zoomTo:(float)minx :(float)miny :(float)maxx :(float)maxy;
  84.  
  85. /* toggles dchi=0 on and off */
  86. -togFreeze:sender;
  87. @end
  88.