2009-01-10 08:18:54 +00:00
|
|
|
|
|
|
|
#ifndef __SURFACE_H
|
|
|
|
#define __SURFACE_H
|
|
|
|
|
2009-01-19 03:33:15 +00:00
|
|
|
// Utility functions, Bernstein polynomials of order 1-3 and their derivatives.
|
2009-01-15 03:55:42 +00:00
|
|
|
double Bernstein(int k, int deg, double t);
|
2009-01-19 03:33:15 +00:00
|
|
|
double BernsteinDerivative(int k, int deg, double t);
|
2009-01-15 03:55:42 +00:00
|
|
|
|
2009-02-27 13:04:36 +00:00
|
|
|
class SSurface;
|
2009-05-18 07:26:51 +00:00
|
|
|
class SCurvePt;
|
2009-02-27 13:04:36 +00:00
|
|
|
|
2009-02-01 05:13:43 +00:00
|
|
|
// Utility data structure, a two-dimensional BSP to accelerate polygon
|
|
|
|
// operations.
|
|
|
|
class SBspUv {
|
|
|
|
public:
|
|
|
|
Point2d a, b;
|
|
|
|
|
|
|
|
SBspUv *pos;
|
|
|
|
SBspUv *neg;
|
|
|
|
|
|
|
|
SBspUv *more;
|
|
|
|
|
|
|
|
static const int INSIDE = 100;
|
|
|
|
static const int OUTSIDE = 200;
|
|
|
|
static const int EDGE_PARALLEL = 300;
|
|
|
|
static const int EDGE_ANTIPARALLEL = 400;
|
|
|
|
static const int EDGE_OTHER = 500;
|
|
|
|
|
|
|
|
static SBspUv *Alloc(void);
|
2009-07-02 03:32:17 +00:00
|
|
|
static SBspUv *From(SEdgeList *el, SSurface *srf);
|
2009-02-01 05:13:43 +00:00
|
|
|
|
2009-07-02 03:32:17 +00:00
|
|
|
void ScalePoints(Point2d *pt, Point2d *a, Point2d *b, SSurface *srf);
|
|
|
|
double ScaledSignedDistanceToLine(Point2d pt, Point2d a, Point2d b,
|
|
|
|
SSurface *srf);
|
|
|
|
double ScaledDistanceToLine(Point2d pt, Point2d a, Point2d b, bool seg,
|
|
|
|
SSurface *srf);
|
|
|
|
|
|
|
|
SBspUv *InsertEdge(Point2d a, Point2d b, SSurface *srf);
|
|
|
|
int ClassifyPoint(Point2d p, Point2d eb, SSurface *srf);
|
|
|
|
int ClassifyEdge(Point2d ea, Point2d eb, SSurface *srf);
|
2009-08-21 04:58:28 +00:00
|
|
|
double MinimumDistanceToEdge(Point2d p, SSurface *srf);
|
2009-02-01 05:13:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Now the data structures to represent a shell of trimmed rational polynomial
|
|
|
|
// surfaces.
|
|
|
|
|
2009-01-19 10:37:10 +00:00
|
|
|
class SShell;
|
|
|
|
|
2009-01-15 03:55:42 +00:00
|
|
|
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
|
2009-04-14 04:19:23 +00:00
|
|
|
// our inputs, and are also calculated for certain exact surface-surface
|
|
|
|
// intersections.
|
2009-01-19 03:51:00 +00:00
|
|
|
class SBezier {
|
2009-01-14 05:10:42 +00:00
|
|
|
public:
|
2009-01-17 05:28:49 +00:00
|
|
|
int tag;
|
2009-09-22 05:46:30 +00:00
|
|
|
int auxA, auxB;
|
|
|
|
|
2009-01-14 05:10:42 +00:00
|
|
|
int deg;
|
|
|
|
Vector ctrl[4];
|
|
|
|
double weight[4];
|
|
|
|
|
2009-01-19 03:33:15 +00:00
|
|
|
Vector PointAt(double t);
|
2009-04-14 04:19:23 +00:00
|
|
|
Vector TangentAt(double t);
|
2009-06-04 03:59:40 +00:00
|
|
|
void ClosestPointTo(Vector p, double *t, bool converge=true);
|
2009-04-14 04:19:23 +00:00
|
|
|
void SplitAt(double t, SBezier *bef, SBezier *aft);
|
2009-07-07 08:21:59 +00:00
|
|
|
bool PointOnThisAndCurve(SBezier *sbb, Vector *p);
|
2009-04-14 04:19:23 +00:00
|
|
|
|
2009-01-15 03:55:42 +00:00
|
|
|
Vector Start(void);
|
|
|
|
Vector Finish(void);
|
2009-03-15 23:04:45 +00:00
|
|
|
bool Equals(SBezier *b);
|
2009-10-12 10:40:48 +00:00
|
|
|
void MakePwlInto(SEdgeList *sel, double chordTol=0);
|
|
|
|
void MakePwlInto(List<SCurvePt> *l, double chordTol=0);
|
2009-10-29 07:16:28 +00:00
|
|
|
void MakePwlInto(SContour *sc, double chordTol=0);
|
2009-10-12 10:40:48 +00:00
|
|
|
void MakePwlInto(List<Vector> *l, double chordTol=0);
|
|
|
|
void MakePwlWorker(List<Vector> *l, double ta, double tb, double chordTol);
|
2009-01-14 05:10:42 +00:00
|
|
|
|
2009-07-07 08:21:59 +00:00
|
|
|
void AllIntersectionsWith(SBezier *sbb, SPointList *spl);
|
2009-01-25 11:52:29 +00:00
|
|
|
void GetBoundingProjd(Vector u, Vector orig, double *umin, double *umax);
|
2009-01-17 05:28:49 +00:00
|
|
|
void Reverse(void);
|
|
|
|
|
2009-10-12 10:40:48 +00:00
|
|
|
bool IsInPlane(Vector n, double d);
|
2009-04-15 02:55:18 +00:00
|
|
|
bool IsCircle(Vector axis, Vector *center, double *r);
|
|
|
|
bool IsRational(void);
|
|
|
|
|
2009-10-09 12:57:10 +00:00
|
|
|
SBezier TransformedBy(Vector t, Quaternion q, bool mirror);
|
2009-04-14 04:19:23 +00:00
|
|
|
SBezier InPerspective(Vector u, Vector v, Vector n,
|
|
|
|
Vector origin, double cameraTan);
|
2009-10-12 09:28:34 +00:00
|
|
|
void ScaleSelfBy(double s);
|
2009-01-23 03:30:30 +00:00
|
|
|
|
2009-01-19 03:51:00 +00:00
|
|
|
static SBezier From(Vector p0, Vector p1, Vector p2, Vector p3);
|
|
|
|
static SBezier From(Vector p0, Vector p1, Vector p2);
|
|
|
|
static SBezier From(Vector p0, Vector p1);
|
2009-04-14 04:19:23 +00:00
|
|
|
static SBezier From(Vector4 p0, Vector4 p1, Vector4 p2, Vector4 p3);
|
|
|
|
static SBezier From(Vector4 p0, Vector4 p1, Vector4 p2);
|
|
|
|
static SBezier From(Vector4 p0, Vector4 p1);
|
2009-01-14 05:10:42 +00:00
|
|
|
};
|
|
|
|
|
2009-01-19 03:51:00 +00:00
|
|
|
class SBezierList {
|
2009-01-14 05:10:42 +00:00
|
|
|
public:
|
2009-01-19 03:51:00 +00:00
|
|
|
List<SBezier> l;
|
2009-01-15 03:55:42 +00:00
|
|
|
|
|
|
|
void Clear(void);
|
2009-10-12 09:28:34 +00:00
|
|
|
void ScaleSelfBy(double s);
|
2009-04-15 02:55:18 +00:00
|
|
|
void CullIdenticalBeziers(void);
|
2009-07-07 08:21:59 +00:00
|
|
|
void AllIntersectionsWith(SBezierList *sblb, SPointList *spl);
|
2009-10-29 07:16:28 +00:00
|
|
|
bool GetPlaneContainingBeziers(Vector *p, Vector *u, Vector *v,
|
|
|
|
Vector *notCoplanarAt);
|
2009-01-14 05:10:42 +00:00
|
|
|
};
|
|
|
|
|
2009-01-19 03:51:00 +00:00
|
|
|
class SBezierLoop {
|
2009-01-17 05:28:49 +00:00
|
|
|
public:
|
2009-06-08 16:21:33 +00:00
|
|
|
int tag;
|
2009-01-19 03:51:00 +00:00
|
|
|
List<SBezier> l;
|
2009-01-17 05:28:49 +00:00
|
|
|
|
2009-01-19 03:33:15 +00:00
|
|
|
inline void Clear(void) { l.Clear(); }
|
2009-10-22 17:16:20 +00:00
|
|
|
bool IsClosed(void);
|
2009-01-19 03:33:15 +00:00
|
|
|
void Reverse(void);
|
2009-10-29 07:16:28 +00:00
|
|
|
void MakePwlInto(SContour *sc, double chordTol=0);
|
2009-01-25 11:52:29 +00:00
|
|
|
void GetBoundingProjd(Vector u, Vector orig, double *umin, double *umax);
|
2009-01-17 05:28:49 +00:00
|
|
|
|
2009-01-19 03:51:00 +00:00
|
|
|
static SBezierLoop FromCurves(SBezierList *spcl,
|
|
|
|
bool *allClosed, SEdge *errorAt);
|
2009-01-17 05:28:49 +00:00
|
|
|
};
|
|
|
|
|
2009-01-19 03:51:00 +00:00
|
|
|
class SBezierLoopSet {
|
2009-01-19 03:33:15 +00:00
|
|
|
public:
|
2009-01-19 03:51:00 +00:00
|
|
|
List<SBezierLoop> l;
|
2009-01-19 03:33:15 +00:00
|
|
|
Vector normal;
|
2009-01-19 10:37:10 +00:00
|
|
|
Vector point;
|
2009-01-19 03:33:15 +00:00
|
|
|
|
2009-01-19 03:51:00 +00:00
|
|
|
static SBezierLoopSet From(SBezierList *spcl, SPolygon *poly,
|
2009-10-29 07:16:28 +00:00
|
|
|
double chordTol,
|
|
|
|
bool *allClosed, SEdge *errorAt,
|
|
|
|
SBezierList *openContours);
|
2009-01-19 03:33:15 +00:00
|
|
|
|
2009-01-25 11:52:29 +00:00
|
|
|
void GetBoundingProjd(Vector u, Vector orig, double *umin, double *umax);
|
2009-10-29 07:16:28 +00:00
|
|
|
void MakePwlInto(SPolygon *sp);
|
2009-01-19 03:33:15 +00:00
|
|
|
void Clear(void);
|
|
|
|
};
|
2009-01-14 05:10:42 +00:00
|
|
|
|
2009-10-22 17:16:20 +00:00
|
|
|
class SBezierLoopSetSet {
|
|
|
|
public:
|
|
|
|
List<SBezierLoopSet> l;
|
|
|
|
|
2009-10-29 07:16:28 +00:00
|
|
|
void FindOuterFacesFrom(SBezierList *sbl, SPolygon *spxyz, SSurface *srfuv,
|
|
|
|
double chordTol,
|
|
|
|
bool *allClosed, SEdge *notClosedAt,
|
|
|
|
bool *allCoplanar, Vector *notCoplanarAt,
|
|
|
|
SBezierList *openContours);
|
2009-10-30 10:38:34 +00:00
|
|
|
void AddOpenPath(SBezier *sb);
|
2009-10-22 17:16:20 +00:00
|
|
|
void Clear(void);
|
|
|
|
};
|
|
|
|
|
2009-01-14 05:10:42 +00:00
|
|
|
// Stuff for the surface trim curves: piecewise linear
|
2009-05-18 07:26:51 +00:00
|
|
|
class SCurvePt {
|
|
|
|
public:
|
|
|
|
int tag;
|
|
|
|
Vector p;
|
|
|
|
bool vertex;
|
|
|
|
};
|
|
|
|
|
2009-01-10 08:18:54 +00:00
|
|
|
class SCurve {
|
|
|
|
public:
|
|
|
|
hSCurve h;
|
|
|
|
|
2009-02-27 13:04:36 +00:00
|
|
|
// In a Boolean, C = A op B. The curves in A and B get copied into C, and
|
|
|
|
// therefore must get new hSCurves assigned. For the curves in A and B,
|
|
|
|
// we use newH to record their new handle in C.
|
|
|
|
hSCurve newH;
|
|
|
|
static const int FROM_A = 100;
|
|
|
|
static const int FROM_B = 200;
|
|
|
|
static const int FROM_INTERSECTION = 300;
|
|
|
|
int source;
|
2009-01-25 11:52:29 +00:00
|
|
|
|
2009-01-19 10:37:10 +00:00
|
|
|
bool isExact;
|
|
|
|
SBezier exact;
|
|
|
|
|
2009-05-18 07:26:51 +00:00
|
|
|
List<SCurvePt> pts;
|
2009-01-19 10:37:10 +00:00
|
|
|
|
2009-01-27 07:59:58 +00:00
|
|
|
hSSurface surfA;
|
|
|
|
hSSurface surfB;
|
|
|
|
|
2009-10-09 12:57:10 +00:00
|
|
|
static SCurve FromTransformationOf(SCurve *a, Vector t, Quaternion q,
|
|
|
|
bool mirror);
|
2009-02-27 13:04:36 +00:00
|
|
|
SCurve MakeCopySplitAgainst(SShell *agnstA, SShell *agnstB,
|
|
|
|
SSurface *srfA, SSurface *srfB);
|
2009-05-18 07:26:51 +00:00
|
|
|
void RemoveShortSegments(SSurface *srfA, SSurface *srfB);
|
2009-06-19 07:56:33 +00:00
|
|
|
SSurface *GetSurfaceA(SShell *a, SShell *b);
|
|
|
|
SSurface *GetSurfaceB(SShell *a, SShell *b);
|
2009-01-23 03:30:30 +00:00
|
|
|
|
2009-01-19 10:37:10 +00:00
|
|
|
void Clear(void);
|
2009-01-10 08:18:54 +00:00
|
|
|
};
|
|
|
|
|
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;
|
2009-01-25 09:19:59 +00:00
|
|
|
bool backwards;
|
|
|
|
// If a trim runs backwards, then start and finish still correspond to
|
|
|
|
// the actual start and finish, but they appear in reverse order in
|
|
|
|
// the referenced curve.
|
2009-01-10 08:18:54 +00:00
|
|
|
Vector start;
|
|
|
|
Vector finish;
|
2009-01-19 10:37:10 +00:00
|
|
|
|
2009-01-25 09:19:59 +00:00
|
|
|
static STrimBy STrimBy::EntireCurve(SShell *shell, hSCurve hsc, bool bkwds);
|
2009-01-10 08:18:54 +00:00
|
|
|
};
|
|
|
|
|
2009-02-01 13:01:28 +00:00
|
|
|
// An intersection point between a line and a surface
|
|
|
|
class SInter {
|
|
|
|
public:
|
2009-02-27 13:04:36 +00:00
|
|
|
int tag;
|
2009-02-01 13:01:28 +00:00
|
|
|
Vector p;
|
2009-02-27 13:04:36 +00:00
|
|
|
SSurface *srf;
|
2009-06-04 03:59:40 +00:00
|
|
|
Point2d pinter;
|
|
|
|
Vector surfNormal; // of the intersecting surface, at pinter
|
|
|
|
bool onEdge; // pinter is on edge of trim poly
|
2009-02-01 13:01:28 +00:00
|
|
|
};
|
|
|
|
|
2009-01-19 10:37:10 +00:00
|
|
|
// A rational polynomial surface in Bezier form.
|
2009-01-10 08:18:54 +00:00
|
|
|
class SSurface {
|
|
|
|
public:
|
2009-06-05 05:38:41 +00:00
|
|
|
int tag;
|
2009-01-10 08:18:54 +00:00
|
|
|
hSSurface h;
|
|
|
|
|
2009-03-15 23:04:45 +00:00
|
|
|
// Same as newH for the curves; record what a surface gets renamed to
|
|
|
|
// when I copy things over.
|
|
|
|
hSSurface newH;
|
|
|
|
|
2009-01-25 09:19:59 +00:00
|
|
|
int color;
|
|
|
|
DWORD face;
|
|
|
|
|
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-17 05:28:49 +00:00
|
|
|
|
2009-02-01 05:13:43 +00:00
|
|
|
// For testing whether a point (u, v) on the surface lies inside the trim
|
|
|
|
SBspUv *bsp;
|
2009-06-04 03:59:40 +00:00
|
|
|
SEdgeList edges;
|
2009-01-27 07:59:58 +00:00
|
|
|
|
2009-08-21 04:58:28 +00:00
|
|
|
// For caching our initial (u, v) when doing Newton iterations to project
|
|
|
|
// a point into our surface.
|
|
|
|
Point2d cached;
|
|
|
|
|
2009-01-19 03:51:00 +00:00
|
|
|
static SSurface FromExtrusionOf(SBezier *spc, Vector t0, Vector t1);
|
2009-04-29 02:42:44 +00:00
|
|
|
static SSurface FromRevolutionOf(SBezier *sb, Vector pt, Vector axis,
|
|
|
|
double thetas, double thetaf);
|
2009-01-25 11:52:29 +00:00
|
|
|
static SSurface FromPlane(Vector pt, Vector u, Vector v);
|
2009-10-09 12:57:10 +00:00
|
|
|
static SSurface FromTransformationOf(SSurface *a, Vector t, Quaternion q,
|
|
|
|
bool mirror,
|
2009-01-23 03:30:30 +00:00
|
|
|
bool includingTrims);
|
2009-10-12 09:28:34 +00:00
|
|
|
void ScaleSelfBy(double s);
|
2009-01-17 05:28:49 +00:00
|
|
|
|
2009-06-04 03:59:40 +00:00
|
|
|
void EdgeNormalsWithinSurface(Point2d auv, Point2d buv,
|
|
|
|
Vector *pt, Vector *enin, Vector *enout,
|
|
|
|
Vector *surfn,
|
2009-06-19 07:56:33 +00:00
|
|
|
DWORD auxA,
|
|
|
|
SShell *shell, SShell *sha, SShell *shb);
|
2009-06-27 05:53:56 +00:00
|
|
|
void FindChainAvoiding(SEdgeList *src, SEdgeList *dest, SPointList *avoid);
|
2009-06-19 07:56:33 +00:00
|
|
|
SSurface MakeCopyTrimAgainst(SShell *parent, SShell *a, SShell *b,
|
|
|
|
SShell *into, int type);
|
2009-06-05 05:38:41 +00:00
|
|
|
void TrimFromEdgeList(SEdgeList *el, bool asUv);
|
2009-02-01 05:13:43 +00:00
|
|
|
void IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
|
|
|
|
SShell *into);
|
2009-02-27 13:04:36 +00:00
|
|
|
void AddExactIntersectionCurve(SBezier *sb, SSurface *srfB,
|
2009-02-23 10:06:02 +00:00
|
|
|
SShell *agnstA, SShell *agnstB, SShell *into);
|
2009-03-19 17:40:11 +00:00
|
|
|
|
2009-03-08 10:59:57 +00:00
|
|
|
typedef struct {
|
|
|
|
int tag;
|
|
|
|
Point2d p;
|
|
|
|
} Inter;
|
|
|
|
void WeightControlPoints(void);
|
|
|
|
void UnWeightControlPoints(void);
|
|
|
|
void CopyRowOrCol(bool row, int this_ij, SSurface *src, int src_ij);
|
|
|
|
void BlendRowOrCol(bool row, int this_ij, SSurface *a, int a_ij,
|
|
|
|
SSurface *b, int b_ij);
|
2009-03-14 20:01:20 +00:00
|
|
|
double DepartureFromCoplanar(void);
|
2009-03-08 10:59:57 +00:00
|
|
|
void SplitInHalf(bool byU, SSurface *sa, SSurface *sb);
|
2009-02-23 10:06:02 +00:00
|
|
|
void AllPointsIntersecting(Vector a, Vector b,
|
2009-03-19 17:40:11 +00:00
|
|
|
List<SInter> *l,
|
|
|
|
bool seg, bool trimmed, bool inclTangent);
|
2009-03-08 10:59:57 +00:00
|
|
|
void AllPointsIntersectingUntrimmed(Vector a, Vector b,
|
|
|
|
int *cnt, int *level,
|
|
|
|
List<Inter> *l, bool segment,
|
|
|
|
SSurface *sorig);
|
2009-01-25 11:52:29 +00:00
|
|
|
|
2009-06-04 03:59:40 +00:00
|
|
|
void ClosestPointTo(Vector p, Point2d *puv, bool converge=true);
|
2009-02-27 13:04:36 +00:00
|
|
|
void ClosestPointTo(Vector p, double *u, double *v, bool converge=true);
|
2009-08-21 04:58:28 +00:00
|
|
|
bool ClosestPointNewton(Vector p, double *u, double *v, bool converge=true);
|
|
|
|
|
2009-02-27 13:04:36 +00:00
|
|
|
bool PointIntersectingLine(Vector p0, Vector p1, double *u, double *v);
|
2009-06-04 03:59:40 +00:00
|
|
|
Vector ClosestPointOnThisAndSurface(SSurface *srf2, Vector p);
|
2009-02-27 13:04:36 +00:00
|
|
|
void PointOnSurfaces(SSurface *s1, SSurface *s2, double *u, double *v);
|
2009-01-19 03:33:15 +00:00
|
|
|
Vector PointAt(double u, double v);
|
2009-06-04 03:59:40 +00:00
|
|
|
Vector PointAt(Point2d puv);
|
2009-01-19 10:37:10 +00:00
|
|
|
void TangentsAt(double u, double v, Vector *tu, Vector *tv);
|
2009-06-04 03:59:40 +00:00
|
|
|
Vector NormalAt(Point2d puv);
|
2009-01-19 03:33:15 +00:00
|
|
|
Vector NormalAt(double u, double v);
|
2009-03-19 17:40:11 +00:00
|
|
|
bool LineEntirelyOutsideBbox(Vector a, Vector b, bool segment);
|
2009-01-27 07:59:58 +00:00
|
|
|
void GetAxisAlignedBounding(Vector *ptMax, Vector *ptMin);
|
2009-02-09 12:40:48 +00:00
|
|
|
bool CoincidentWithPlane(Vector n, double d);
|
|
|
|
bool CoincidentWith(SSurface *ss, bool sameNormal);
|
2009-02-23 10:06:02 +00:00
|
|
|
bool IsExtrusion(SBezier *of, Vector *along);
|
2009-04-15 02:55:18 +00:00
|
|
|
bool IsCylinder(Vector *axis, Vector *center, double *r,
|
|
|
|
Vector *start, Vector *finish);
|
2009-01-19 03:33:15 +00:00
|
|
|
|
2009-01-19 10:37:10 +00:00
|
|
|
void TriangulateInto(SShell *shell, SMesh *sm);
|
2009-08-21 04:58:28 +00:00
|
|
|
|
|
|
|
// these are intended as bitmasks, even though there's just one now
|
|
|
|
static const int AS_UV = 0x01;
|
|
|
|
static const int AS_XYZ = 0x00;
|
|
|
|
void MakeTrimEdgesInto(SEdgeList *sel, int flags, SCurve *sc, STrimBy *stb);
|
|
|
|
void MakeEdgesInto(SShell *shell, SEdgeList *sel, int flags,
|
2009-03-15 23:04:45 +00:00
|
|
|
SShell *useCurvesFrom=NULL);
|
2009-08-21 04:58:28 +00:00
|
|
|
|
2009-06-22 02:54:09 +00:00
|
|
|
Vector ExactSurfaceTangentAt(Vector p, SSurface *srfA, SSurface *srfB,
|
|
|
|
Vector dir);
|
2009-04-14 04:19:23 +00:00
|
|
|
void MakeSectionEdgesInto(SShell *shell, SEdgeList *sel, SBezierList *sbl);
|
2009-06-04 03:59:40 +00:00
|
|
|
void MakeClassifyingBsp(SShell *shell, SShell *useCurvesFrom);
|
2009-02-27 14:05:08 +00:00
|
|
|
double ChordToleranceForEdge(Vector a, Vector b);
|
2009-05-08 08:33:04 +00:00
|
|
|
void MakeTriangulationGridInto(List<double> *l, double vs, double vf,
|
|
|
|
bool swapped);
|
|
|
|
Vector PointAtMaybeSwapped(double u, double v, bool swapped);
|
2009-01-19 10:37:10 +00:00
|
|
|
|
2009-02-16 12:05:08 +00:00
|
|
|
void Reverse(void);
|
2009-01-19 10:37:10 +00:00
|
|
|
void Clear(void);
|
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;
|
2009-01-17 05:28:49 +00:00
|
|
|
|
2009-05-30 08:49:09 +00:00
|
|
|
bool booleanFailed;
|
|
|
|
|
2009-01-25 09:19:59 +00:00
|
|
|
void MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1,
|
|
|
|
int color);
|
2009-04-29 02:42:44 +00:00
|
|
|
void MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
|
|
|
|
int color);
|
2009-01-25 11:52:29 +00:00
|
|
|
|
2009-01-23 03:30:30 +00:00
|
|
|
void MakeFromUnionOf(SShell *a, SShell *b);
|
|
|
|
void MakeFromDifferenceOf(SShell *a, SShell *b);
|
2009-01-25 11:52:29 +00:00
|
|
|
static const int AS_UNION = 10;
|
|
|
|
static const int AS_DIFFERENCE = 11;
|
|
|
|
static const int AS_INTERSECT = 12;
|
|
|
|
void MakeFromBoolean(SShell *a, SShell *b, int type);
|
2009-02-27 13:04:36 +00:00
|
|
|
void CopyCurvesSplitAgainst(bool opA, SShell *agnst, SShell *into);
|
2009-06-19 07:56:33 +00:00
|
|
|
void CopySurfacesTrimAgainst(SShell *sha, SShell *shb, SShell *into,
|
|
|
|
int type);
|
2009-01-27 07:59:58 +00:00
|
|
|
void MakeIntersectionCurvesAgainst(SShell *against, SShell *into);
|
2009-06-04 03:59:40 +00:00
|
|
|
void MakeClassifyingBsps(SShell *useCurvesFrom);
|
2009-02-23 10:06:02 +00:00
|
|
|
void AllPointsIntersecting(Vector a, Vector b, List<SInter> *il,
|
2009-03-19 17:40:11 +00:00
|
|
|
bool seg, bool trimmed, bool inclTangent);
|
2009-02-09 12:40:48 +00:00
|
|
|
void MakeCoincidentEdgesInto(SSurface *proto, bool sameNormal,
|
2009-03-15 23:04:45 +00:00
|
|
|
SEdgeList *el, SShell *useCurvesFrom);
|
2009-05-20 03:04:36 +00:00
|
|
|
void RewriteSurfaceHandlesForCurves(SShell *a, SShell *b);
|
2009-01-27 07:59:58 +00:00
|
|
|
void CleanupAfterBoolean(void);
|
2009-01-25 11:52:29 +00:00
|
|
|
|
2009-06-04 03:59:40 +00:00
|
|
|
// Definitions when classifying regions of a surface; it is either inside,
|
|
|
|
// outside, or coincident (with parallel or antiparallel normal) with a
|
|
|
|
// shell.
|
|
|
|
static const int INSIDE = 100;
|
|
|
|
static const int OUTSIDE = 200;
|
|
|
|
static const int COINC_SAME = 300;
|
|
|
|
static const int COINC_OPP = 400;
|
|
|
|
static const double DOTP_TOL;
|
|
|
|
int ClassifyRegion(Vector edge_n, Vector inter_surf_n, Vector edge_surf_n);
|
|
|
|
bool ClassifyEdge(int *indir, int *outdir,
|
|
|
|
Vector ea, Vector eb,
|
|
|
|
Vector p,
|
|
|
|
Vector edge_n_in, Vector edge_n_out, Vector surf_n);
|
2009-02-01 13:01:28 +00:00
|
|
|
|
2009-01-23 03:30:30 +00:00
|
|
|
void MakeFromCopyOf(SShell *a);
|
2009-10-09 12:57:10 +00:00
|
|
|
void MakeFromTransformationOf(SShell *a, Vector trans, Quaternion q,
|
|
|
|
bool mirror);
|
2009-05-20 03:04:36 +00:00
|
|
|
void MakeFromAssemblyOf(SShell *a, SShell *b);
|
2009-06-05 05:38:41 +00:00
|
|
|
void MergeCoincidentSurfaces(void);
|
2009-01-19 10:37:10 +00:00
|
|
|
|
|
|
|
void TriangulateInto(SMesh *sm);
|
2009-01-23 03:30:30 +00:00
|
|
|
void MakeEdgesInto(SEdgeList *sel);
|
2009-04-14 04:19:23 +00:00
|
|
|
void MakeSectionEdgesInto(Vector n, double d,
|
|
|
|
SEdgeList *sel, SBezierList *sbl);
|
2009-05-24 11:37:07 +00:00
|
|
|
bool IsEmpty(void);
|
|
|
|
void RemapFaces(Group *g, int remap);
|
2009-01-19 10:37:10 +00:00
|
|
|
void Clear(void);
|
2009-01-10 08:18:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|