2009-01-10 08:18:54 +00:00
|
|
|
|
|
|
|
#ifndef __SURFACE_H
|
|
|
|
#define __SURFACE_H
|
|
|
|
|
2009-01-15 03:55:42 +00:00
|
|
|
// Utility function
|
|
|
|
double Bernstein(int k, int deg, double t);
|
|
|
|
|
|
|
|
class hSSurface {
|
|
|
|
public:
|
|
|
|
DWORD v;
|
|
|
|
};
|
|
|
|
|
|
|
|
class hSCurve {
|
|
|
|
public:
|
|
|
|
DWORD v;
|
|
|
|
};
|
2009-01-10 08:18:54 +00:00
|
|
|
|
2009-01-14 05:10:42 +00:00
|
|
|
// Stuff for rational polynomial curves, of degree one to three. These are
|
|
|
|
// our inputs.
|
|
|
|
class SPolyCurve {
|
|
|
|
public:
|
|
|
|
int deg;
|
|
|
|
Vector ctrl[4];
|
|
|
|
double weight[4];
|
|
|
|
|
|
|
|
Vector EvalAt(double t);
|
2009-01-15 03:55:42 +00:00
|
|
|
Vector Start(void);
|
|
|
|
Vector Finish(void);
|
|
|
|
void MakePwlInto(List<Vector> *l);
|
|
|
|
void MakePwlWorker(List<Vector> *l, double ta, double tb);
|
2009-01-14 05:10:42 +00:00
|
|
|
|
|
|
|
static SPolyCurve From(Vector p0, Vector p1, Vector p2, Vector p3);
|
2009-01-15 03:55:42 +00:00
|
|
|
static SPolyCurve From(Vector p0, Vector p1, Vector p2);
|
2009-01-14 05:10:42 +00:00
|
|
|
static SPolyCurve From(Vector p0, Vector p1);
|
|
|
|
};
|
|
|
|
|
|
|
|
class SPolyCurveList {
|
|
|
|
public:
|
|
|
|
List<SPolyCurve> l;
|
2009-01-15 03:55:42 +00:00
|
|
|
|
|
|
|
void Clear(void);
|
2009-01-14 05:10:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Stuff for the surface trim curves: piecewise linear
|
2009-01-10 08:18:54 +00:00
|
|
|
class SCurve {
|
|
|
|
public:
|
|
|
|
hSCurve h;
|
|
|
|
|
2009-01-15 03:55:42 +00:00
|
|
|
List<Vector> pts;
|
2009-01-10 08:18:54 +00:00
|
|
|
hSSurface srfA;
|
|
|
|
hSSurface srfB;
|
|
|
|
};
|
|
|
|
|
2009-01-14 05:10:42 +00:00
|
|
|
// A segment of a curve by which a surface is trimmed: indicates which curve,
|
|
|
|
// by its handle, and the starting and ending points of our segment of it.
|
|
|
|
// The vector out points out of the surface; it, the surface outer normal,
|
|
|
|
// and a tangent to the beginning of the curve are all orthogonal.
|
2009-01-10 08:18:54 +00:00
|
|
|
class STrimBy {
|
|
|
|
public:
|
|
|
|
hSCurve curve;
|
|
|
|
Vector start;
|
|
|
|
Vector finish;
|
2009-01-14 05:10:42 +00:00
|
|
|
Vector out;
|
2009-01-10 08:18:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SSurface {
|
|
|
|
public:
|
|
|
|
hSSurface h;
|
|
|
|
|
2009-01-14 05:10:42 +00:00
|
|
|
int degm, degn;
|
2009-01-10 08:18:54 +00:00
|
|
|
Vector ctrl[4][4];
|
2009-01-14 05:10:42 +00:00
|
|
|
double weight[4][4];
|
2009-01-10 08:18:54 +00:00
|
|
|
|
2009-01-15 03:55:42 +00:00
|
|
|
List<STrimBy> trim;
|
2009-01-10 08:18:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class SShell {
|
|
|
|
public:
|
2009-01-14 05:10:42 +00:00
|
|
|
IdList<SCurve,hSCurve> curve;
|
2009-01-10 08:18:54 +00:00
|
|
|
IdList<SSurface,hSSurface> surface;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|