ftp.nice.ch/pub/next/science/mathematics/2DLab.NIHS.bs.tar.gz#/2DLab/Source/TwoDView.h

This is TwoDView.h in view mode; [Download] [Up]

/* Generated by Interface Builder */

#include <math.h>
#include <stdio.h>
#include <sys/file.h>

#import <dpsclient/wraps.h>

#import <streams/streams.h>

#import <appkit/Matrix.h> 
#import <appkit/Form.h> 
#import <appkit/Button.h> 
#import <appkit/NXColorWell.h>
#import <appkit/TextField.h>
#import <appkit/Slider.h>
#import <appkit/color.h>
#import <appkit/nextstd.h>
#import <appkit/Pasteboard.h>
#import <appkit/SavePanel.h>
#import <appkit/Panel.h>
#import <appkit/NXBitmapImageRep.h>

#include "headers.h" /* for Voronoi */

typedef enum { OP_PRIM_MST,OP_KRUSKAL_MST,OP_JARVIS_HULL, OP_GRAHAM_HULL,
               OP_VORONOI_DIAGRAM,OP_DELAUNAY_TRIANGULATION, OP_GABRIEL_GRAPH,
               OP_RELATIVE_NEIGHBORHOOD_GRAPH} op;

typedef enum { DISP_PTS_ONLY, DISP_PTS_RESULTS } displayFlagType;
/* handy macros */
#define X(i) data[(i)*2]
#define Y(i) data[(i)*2+1]

/* when we want to refer to a 2D point by `name' (in cost function calls) */
#define XY(i) &data[(i)*2]

/* extern */
extern long random();
extern void srandom(int);

@interface TwoDView: View
{
  float *data; /* data[i*2+j], j=0,1, i=1..numPoints (dynamic) */
  int numPoints;
  op operation;
  displayFlagType displayFlag;
  BOOL instanceMode;
  int autoUpdate;
  float width;

  id numPointsForm;
  id bgColorWell;
  id fgColorWell;
  id highColorWell;
  id lineWidthText;
  id lineWidthSlider;
  id statusText;

  /* storange must be allocated for some output data structures.
     Specifically, we need to allocate an array of indices for the
     MST edges ((numPoints-1)*2 integers), an array of (numPoints)
     integers for the convex hull edges (worst case).

     We don't need any visible storage for the voronoi/Delaunay data
     structure because the libvoronoi routines allocate memory for that
     stuff internally. */

  BOOL mstExists;
  int *mst_edge;
  BOOL chExists;
  int *ch_vertex;
  int nch_vertices;
  BOOL vorExists;   /* voronoi OK => Delaunay OK */
  BOOL dtExists;
  int *dt_edge;
  int ndt_edge;
  BOOL ggExists;
  int *gg_edge;
  int ngg_edge;
  BOOL rngExists;
  int *rng_edge;
  int nrng_edge;
}

+ newFrame:(NXRect *)frameRect;

- setFgColorWell:sender;
- setBgColorWell:sender;
- setHighColorWell:sender;
- setAutoUpdate:sender;
- setOperation:sender;

- random:sender;
- animThenDisp:sender;
- disp:sender;
- (BOOL)acceptsFirstResponder;
- mouseDown:(NXEvent *)theEvent;
- free;
- doPrimMST;
- doKruskalMST;
- doJarvisHull;
- doGrahamHull;
- erase;
- drawEdge:(float)x1:(float)y1:(float)x2:(float)y2;
- drawDT;
- drawGG;
- drawRNG;
- drawSelf:(NXRect *)rects:(int) rectCount;
- doVoronoiDiagram;
- doDelaunayTriangulation;
- doGabrielGraph;
- doRelativeNeighborhoodGraph;

-saveTIFF:sender;
-saveEPS:sender;

-openData:sender;
-saveData:sender;
-close:sender;

-copy:sender;

-lineWidthChanged:sender;
-(BOOL)acceptsFirstMouse;
@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.