/* Constants */

#define NOTELEN        80
#define EQLEN	       80
#define NUMINDVAR	9


/* FORM and CHUNK ID's */

#define ID_3DPL   MakeID('3','D','P','L')
#define ID_DRAW   MakeID('D','R','A','W')
#define ID_AXES   MakeID('A','X','E','S')
#define ID_TICS   MakeID('T','I','C','S')
#define ID_NOTE   MakeID('N','O','T','E')
#define ID_EQUN   MakeID('E','Q','U','N')
#define ID_TYPE   MakeID('T','Y','P','E')


/* Structure definitions */

typedef struct {
  DOUBLE RotationX, RotationY,
	 RotationZ;		      /* Rotation about each axis
					 in degrees */
  LONG	 OriginX, OriginY;	      /* Location of origin in window
					 by pixels */
  DOUBLE ProjPlane, ViewDist, Scale;  /* Location of projection plane along
					 the default Z-axis, viewer distance
					 from the projection plane in axis
					 units, & pixels per axis unit */
  DOUBLE LineSpacingX, LineSpacingY;  /* Distance between grid lines
					 in axis units */
  DOUBLE PlotXmin, PlotXmax,
	 PlotYmin, PlotYmax;	      /* Plot region in X-Y plane in
					 axis units */
  DOUBLE PlotPrecisionX,
	 PlotPrecisionY;	      /* Distance between each plotted point
					 along grid lines in axis units */
} DrawData;


typedef struct {
  DOUBLE AxesXmin, AxesXmax,
	 AxesYmin, AxesYmax,
	 AxesZmin, AxesZmax;	   /* Axes range in 3 directions in
				      axis units */
  DOUBLE AxesPrecision; 	   /* Distance between each plotted point
				      along each axis in axis units */
} AxesData;


typedef struct {
  DOUBLE TicX, TicY, TicZ;	      /* Distance between tic marks in
					 axis units */
  ULONG  NumTicX, NumTicY, NumTicZ;   /* Number of tics between axis number
					 labels */
} TicData;


typedef struct {
  UBYTE DependVar;		/* Dependent variable */
  UBYTE IndependVar[NUMINDVAR];  /* Independent variables */
  TEXT	Equation[EQLEN];	   /* Function DependVar = "F(IndependVar)" */
} EqInfo;


typedef struct {
  UBYTE  Surface, AxesType,
	 RotationOrder, Pad0;	   /* Surface type, axes type, rotation
				      order, & pad */
} PlotInfo;


/* The NOTE can be any string variable */


/* Structure that contains all above data */

typedef struct {
   DrawData dd;
   AxesData ad;
   TicData  td;
   EqInfo   ei;
   PlotInfo pi;
   TEXT     nt[NOTELEN];
} AllPlotData;


/* Macros for writing data to file */

#define PutDRAW(context,drawData) \
	PutCk(ID_DRAW,sizeof(DrawData),context,(BYTE *)drawData)

#define PutAXES(context,axesData) \
	PutCk(ID_AXES,sizeof(AxesData),context,(BYTE *)axesData)

#define PutTICS(context,ticData) \
	PutCk(ID_TICS,sizeof(TicData),context,(BYTE *)ticData)

#define PutEQUN(context,eqInfo) \
	PutCk(ID_EQUN,sizeof(EqInfo),context,(BYTE *)eqInfo)

#define PutTYPE(context,plotInfo) \
	PutCk(ID_TYPE,sizeof(PlotInfo),context,(BYTE *)plotInfo)

#define PutNOTE(context,note) \
	PutCk(ID_NOTE,NOTELEN,context,note)


/* Definitions for PlotInfo structure */

/* Surface */

#define XONLY  0
#define YONLY  1
#define XANDY  2

/* AxesType */

#define AXESTYPENONE   0
#define AXESTYPESTAR   1
#define AXESTYPEBOX    2

/* RotationOrder */

#define ROTATEXYZ    0
#define ROTATEXZY    1
#define ROTATEYXZ    2
#define ROTATEYZX    3
#define ROTATEZXY    4
#define ROTATEZYX    5


/* Symbolic representation */

/*

3DPL ::= "FORM" #{ "3DPL" [DRAW] [AXES] [TICS] EQUN* [TYPE] [NOTE]* }

DRAW ::= "DRAW" #{ DrawData }

AXES ::= "AXES" #{ AxesData }

TICS ::= "TICS" #{ TicData }

EQUN ::= "EQUN" #{ EqInfo }

TYPE ::= "TYPE" #{ PlotInfo }

NOTE ::= "NOTE" #{ UBYTE* }

*/
