Overture  Version 25
FaceInfo.h
Go to the documentation of this file.
1 #ifndef FACE_INFO_H
2 #define FACE_INFO_H
3 
4 #include "Mapping.h"
5 #include "NurbsMapping.h"
7 #include "CompositeSurface.h"
8 #include "TrimmedMapping.h"
9 
10 class EdgeInfo;
11 class FaceInfo;
12 class Loop;
13 class EdgeInfoArray;
14 
16 {
17 public:
18 CurveSegment();
19 CurveSegment(NurbsMapping &newSegment, int sp, int surf, NurbsMapping *sLoop, NurbsMapping *sCurve);
22 getNURBS(){return map;}
23 // note that usage includes the initialCurve pointer in the EdgeInfo object,
24 // so for a boundary curve, both the curve and initialCurve will point to the same CurveSegment.
25 bool
26 isBoundary(){return usage == 2;}
27 bool
28 isManifold(){return usage == 3;}
29 bool
30 isNonManifold(){return usage > 3;}
31 static int
32 getGlobalCount(){return globalCount;}
33 static void
34 resetGlobalCount(){globalCount=0;}
35 int
36 getCurveNumber(){return curveNumber;}
37 int
38 put(GenericDataBase & dir, const aString & name, CompositeSurface & cs);
39 int
40 get(GenericDataBase & dir, const aString & name, CompositeSurface & cs, NurbsMapping **allSurfaceLoops);
41 
44 
45 int usage; // delete the object when the usage goes down to 0. A usage of 2 for all sub-curves indicates
46 // a topologically closed model, usage==1 is a boundary curve and usage>=3 indicates non-manifold geometry.
47 
48 int numberOfGridPoints; // be aware that numberOfGridPoints really is redundant and it is the
49 // number of grid points from getNURBS()->getGridDimension(axis) that is used when plotting and triangulating
52 
53 // surfaceLoop is the trimming curve in parameter space and subCurve
54 // is the subCurve of the trimming curve corresponding to this edge (newSegment).
55 // For untrimmed surfaces surfaceLoop points to a curve around the unit square and subCurve points
56 // to one of its segments.
58 
59 // old way: just store the number for the trimming curve and sub-curve. This makes it hard to deal with
60 // splitting and joining of edges. BoundaryCurve was used for untrimmed surfaces, to indicate the side
61 // and axis of the unit square.
62 //int surfaceLoop, subCurve, boundaryCurve;
63 private:
64 NurbsMapping *map; // all curves are represented as NURBS mappings
65 static int globalCount;
66 int curveNumber;
67 };
68 
69 class EdgeInfo
70 {
71 public:
72 EdgeInfo();
73 EdgeInfo(CurveSegment *newCurve, int l, int f, int o, int e);
74 ~EdgeInfo();
75 int
77 int
78 getEndPoint();
79 bool
80 setStartPoint(int np, realArray & endPoint, real mergeTolerance, int firstEdgeNumber, EdgeInfoArray &masterEdge,
81  EdgeInfoArray &unusedEdges);
82 bool
83 setEndPoint(int np, realArray & endPoint, real mergeTolerance, int firstEdgeNumber, EdgeInfoArray &masterEdge,
84  EdgeInfoArray &unusedEdges);
85 bool
86 adjustOneSegmentEndPoints(realArray & endPoint, real mergeTolerance);
87 void
88 eraseEdge();
89 int
91 void
92 setUnused(EdgeInfoArray &unusedEdges);
93 int
94 put(GenericDataBase & dir, const aString & name);
95 int
96 get(GenericDataBase & dir, const aString & name, CurveSegment * allCurveSegments[]);
97 void
98 assignPointers(EdgeInfo * allEdgeInfos[]);
99 
101 Loop *loopy; // pointer to the loop where this edge lives (useful for removal of zero-length edges)
102 
106 {
111 } status;
112 
113 private:
114 EdgeInfo(EdgeInfo & dum){}
115 // only used during a get() before all pointers have been assigned
116 int prevNumber, nextNumber, slaveNumber, masterNumber;
117 };
118 
119 
121 {
122 public:
123 EdgeInfoArray();
125 void
126 resize(int size);
127 int
128 getLength(){return nMax;}
129 void
130 push(EdgeInfo &e);
131 EdgeInfo *
132 pop();
133 int
134 put(GenericDataBase & dir, const aString & name) const;
135 int
136 get(GenericDataBase & dir, const aString & name, EdgeInfo * allEdgeInfos[]);
137 
138 int nMax;
140 private:
142 int sp;
143 };
144 
145 
146 class Loop
147 {
148 public:
149 Loop();
150 ~Loop();
151 
152 void
153 insertEdge(EdgeInfo * newEdge);
154 
155 bool
156 addEdge(EdgeInfo * newEdge, EdgeInfo * loc);
157 
158 bool
159 replaceEdge(EdgeInfo *newEdge, EdgeInfo * oldEdge);
160 
161 bool
162 removeEdge(EdgeInfo * oldEdge);
163 
164 bool
165 deleteEdge(EdgeInfo * oldEdge);
166 
167 int
168 numberOfEdges();
169 
170 void
172 
173 bool
174 edgeInLoop(EdgeInfo * oldEdge);
175 
176 int
177 put(GenericDataBase & dir, const aString & name);
178 
179 int
180 get(GenericDataBase & dir, const aString & name, EdgeInfo * allEdgeInfos[]);
181 
183 int trimOrientation; // 1 for outer curves, -1 for inner curves
184 };
185 
186 
187 class FaceInfo
188 {
189 public:
190 
191 FaceInfo();
192 
193 ~FaceInfo();
194 
195 void
196 allocateLoops(int nol);
197 
198 int
199 put(GenericDataBase & dir, const aString & name);
200 
201 int
202 get(GenericDataBase & dir, const aString & name, EdgeInfo * allEdgeInfos[]);
203 
206 };
207 
208 #endif