/* * Data Types */ typedef struct { double x,y; } RealPoint2D; typedef RealPoint2D Points[4]; typedef double matrix[4][4]; typedef struct { /* spline curve segment */ int degree; int overlap; matrix basis; } spline; /* * User-callable functions. */ RealPoint2D GetMouseButtonPush(); void AddControlPoint( /* RealPoint2D p*/ ); void SetUpSpline(/* int s, double subdiv, int style */ ); /* s: spline type, e.g., CubicCatumullRom */ /* subdiv: stepsize, e.g., 1.0/16.0 */ /* style: curve colour style */ void SetEvaluation(/* int t */); /* t: curve evaluation mode */ /* * Constants and types relevant to Spline.c. */ #ifndef TRUE #define TRUE (1==1) #define FALSE (1==0) #endif #define NumberOfSplines 5 #define Evaluations 5 /* * Kinds of splines. You need to add support for CubicBezier and * CubicLagrange in Spline.c. */ #define CubicCatmullRom 1 #define CubicBSpline 2 #define CubicBezier 3 #define CubicLagrange 4 /* * Curve colour style */ #define MultiColour 0 #define Black 1 /* * Evaluation Modes: * DirectTM multiply TMP every time * DirectMP premultiply MP to get A * Horner use Horner's rule * ForwardDiff use forward differencing * TableLookup use table lookup */ #define DirectTM 1 #define DirectMP 2 #define Horner 3 #define ForwardDiff 4 #define TableLookup 5 #define SUBDIVISIONS 24 #define MAXSEG 100 #define abs(x) ( (x) > 0 ? (x) : -(x) ) #define sign(x) ( (x) < 0 ? -1 : 1 ) #define round(x) ( (int)( (x)>=0 ? (x)+0.5 : (x)-0.5 ) ) /* * For Assignment 3. */ #define CheckOff 1 #define CheckArcLength 2 #define CheckStrain 3