JunkBox_Lib++ (for Windows) 1.10.1
Loading...
Searching...
No Matches
Brep.h
Go to the documentation of this file.
1#ifndef __JBXL_BREP_H_
2#define __JBXL_BREP_H_
3
14#ifdef WIN32
15#pragma warning(disable:4251)
16#endif
17
18
19#include "ClassBox.h"
20
21#include <list>
22#include <algorithm>
23
24#include "Vector.h"
25#include "TVector.h"
26
27
28
29namespace jbxl {
30
31
40
41typedef std::list<BREP_SOLID*> BREP_SOLID_LIST;
42typedef std::list<BREP_SHELL*> BREP_SHELL_LIST;
43typedef std::list<BREP_FACET*> BREP_FACET_LIST;
44typedef std::list<BREP_CONTOUR*> BREP_CONTOUR_LIST;
45typedef std::list<BREP_EDGE*> BREP_EDGE_LIST;
46typedef std::list<BREP_WING*> BREP_WING_LIST;
47typedef std::list<BREP_VERTEX*> BREP_VERTEX_LIST;
48
51
54
55DllExport BREP_VERTEX* AddVertex2Octree(BREP_VERTEX* vertex, OctreeNode* octree, bool dupli=false);
56DllExport BREP_VERTEX** GetOctreeVertices(OctreeNode* octree, long int* vertexno); // 要 free
57DllExport long int OctreeGetter(OctreeNode* p, BREP_VERTEX** vtx, long int counter);
58
62
64
65
66
68// BREP_SOLID
69//
70
72{
73public:
74 unsigned int facetno;
75 unsigned int vertexno;
76 unsigned int vertexid;
77 int vcount;
78
82
85
88
89 std::string name;
91
92 bool freed;
93
94public:
95 BREP_SOLID();
96 virtual ~BREP_SOLID();
97
98 void FreeData(void);
99 void CloseData(void);
100 void ConnectShell(BREP_SHELL* shell);
101 void DisconnectShell(BREP_SHELL* shell);
102};
103
104
105inline void freeBrepSolid(BREP_SOLID*& solid) { if(solid!=NULL){ solid->FreeData(); delete solid; solid=NULL;} }
106
107
108
110// BREP_SHELL
111//
112
114{
115public:
119
120public:
121 BREP_SHELL(BREP_SOLID* pr_solid);
122 virtual ~BREP_SHELL();
123
124 void CloseData();
125 void ConnectFacet(BREP_FACET* facet);
126 void DisconnectFacet(BREP_FACET* facet);
127};
128
129
130
132// BREP_FACET
133//
134
136{
137public:
140
143
144 double d;
145 double tolerance;
146
149
150public:
151 BREP_FACET(BREP_SHELL* pr_shell);
152 virtual ~BREP_FACET();
153
154 void CloseData();
155 void ConnectContour(BREP_CONTOUR* contour);
156 void DisconnectContour(BREP_CONTOUR* contour);
157
158 void ComputePlaneEquation();
159};
160
161
162
164// BREP_CONTOUR
165//
166
168{
169public:
172
175
180
184
185public:
186 BREP_CONTOUR(BREP_FACET* pr_facet);
187 virtual ~BREP_CONTOUR();
188
189 void CloseData();
190 void ConnectWing(BREP_WING* wing);
191 void DisconnectWing(BREP_WING* wing);
192 void DestroyWings();
193
194 void CloseFacet(BREP_FACET* facet, double& emax, double& dmin, double& dmax);
195 void ComputeNormal();
196 void ComputeDirectRS();
197
198 BREP_WING* CreateWing(BREP_VERTEX* vertex1, BREP_VERTEX* vertex2);
199};
200
201
202
204// BREP_WING
205//
206
223
224
225
227// BREP_EDGE
228//
229
231{
232public:
235
238
239 bool complete;
240 double tolerance;
241
242public:
243 BREP_EDGE(BREP_VERTEX* vertex1, BREP_VERTEX* vertex2);
244 virtual ~BREP_EDGE();
245
246 void CloseData();
247};
248
249
250
252// BREP_VERTEX
253//
254
256{
257public:
259
264
265 // optional
266 long int index;
268
269 double distance2;
270 double tolerance;
271
273
274public:
275 BREP_VERTEX();
276 virtual ~BREP_VERTEX();
277
278 void CloseData();
279 void DisconnectWing(BREP_WING* wing);
280
281 void ComputeNormal();
282 void ComputeTolerance();
283};
284
285
286
288// OctreeNode
289//
290
292{
293public:
295
296private:
298 OctreeNode* child[8];
299
300public:
302 OctreeNode(BREP_VERTEX* new_vertex, BREP_SOLID* sld);
303 ~OctreeNode();
304
307 OctreeNode* AddWithUnique(BREP_VERTEX* new_vertex);
308
311 OctreeNode* AddWithDuplicates(BREP_VERTEX* new_vertex);
312
314 OctreeNode* FindSubtree(BREP_VERTEX* element);
315
316 //
317 void ComputeVerticesNormal(void);
318
319 //
320 friend BREP_VERTEX** GetOctreeVertices(OctreeNode* octree, long int* vertexno);
321 friend long int OctreeGetter(OctreeNode* p, BREP_VERTEX** vtx, long int counter);
322
323 friend BREP_VERTEX* AddVertex2Octree(BREP_VERTEX* vertex, OctreeNode* octree, bool dupli);
324};
325
326
327} // namespace
328
329
330#endif
331
C++ ToolBox of Class.
トレランス付き(信頼精度付き)ベクトル ライブラリ ヘッダ
ベクトルライブラリ for C++
int dup_edge
多重エッジの数.
Definition Brep.h:181
TVector< double > directRS
Definition Brep.h:179
BREP_FACET * facet
Definition Brep.h:170
BREP_WING * wing
Definition Brep.h:171
Vector< double > normal
Definition Brep.h:174
TVector< double > directS
Definition Brep.h:178
RBound< double > rbound
Definition Brep.h:173
TVector< double > directR
△QRS 三角Contour衝突検出用
Definition Brep.h:177
bool hasCollisionVector
Definition Brep.h:183
Vector< double > center
Definition Brep.h:236
BREP_EDGE_LIST * edge_list
多重エッジのリストへのポインタ
Definition Brep.h:237
BREP_WING * wing2
Definition Brep.h:234
double tolerance
Definition Brep.h:240
BREP_WING * wing1
Definition Brep.h:233
bool complete
完全なエッジ.2つの Wingは共に使用されている.
Definition Brep.h:239
BREP_SHELL * shell
Definition Brep.h:138
double d
定数,原点から平面への距離*(-1)
Definition Brep.h:144
bool notdelete
削除してはいけない
Definition Brep.h:148
double tolerance
Definition Brep.h:145
Vector< double > normal
Definition Brep.h:141
BREP_CONTOUR_LIST outer_contours
Definition Brep.h:139
RBound< double > rbound
Definition Brep.h:142
bool deletable
削除できる
Definition Brep.h:147
RBound< double > rbound
Definition Brep.h:118
BREP_SOLID * solid
Definition Brep.h:116
BREP_FACET_LIST facets
Definition Brep.h:117
OctreeNode * octree
Definition Brep.h:80
unsigned int vertexno
頂点の数
Definition Brep.h:75
BREP_CONTOUR_LIST contours
Contours リスト
Definition Brep.h:83
CVCounter * counter
仮想計量カウンタ
Definition Brep.h:90
bool freed
開放済み確認フラグ
Definition Brep.h:92
unsigned int facetno
面の数
Definition Brep.h:74
std::string name
Definition Brep.h:89
RBound< double > rbound
Definition Brep.h:81
int vcount
1面あたりの頂点数
Definition Brep.h:77
BREP_WING_LIST wings
Wings リスト
Definition Brep.h:84
BREP_WING_LIST shortage_wings
不足 Wings リスト
Definition Brep.h:87
unsigned int vertexid
頂点のカウンタ.Vertex のIDを決める際に使用
Definition Brep.h:76
BREP_CONTOUR_LIST surplus_contours
過剰 Contours リスト
Definition Brep.h:86
BREP_SHELL_LIST shells
Definition Brep.h:79
void FreeData(void)
Definition Brep.cpp:56
bool calc_normal
normal を計算するか? しない場合は入力値を使用する.
Definition Brep.h:267
long int index
シーケンシャルに増加する一意的な番号.Octree に格納されるときに設定される.
Definition Brep.h:266
Vector< double > point
頂点の座標.
Definition Brep.h:260
double distance2
Definition Brep.h:269
double tolerance
Definition Brep.h:270
Vector< double > normal
法線ベクトル.周りの Contour の法線ベクトルの平均.
Definition Brep.h:261
BREP_WING_LIST wing_list
Definition Brep.h:258
ArrayParam< int > weight
頂点の重み.要正規化.
Definition Brep.h:263
BREP_VERTEX_LIST * forbidden_list
お互いに Edgeを張ることを禁止された Vertexの List
Definition Brep.h:272
UVMap< double > uvmap
曲面のUV座標
Definition Brep.h:262
void CloseData()
Definition Brep.h:221
BREP_CONTOUR * contour
Definition Brep.h:215
virtual ~BREP_WING()
Definition Brep.h:219
BREP_WING * next
Definition Brep.h:212
BREP_VERTEX * vertex
Start of Vertex.
Definition Brep.h:210
BREP_EDGE * edge
Definition Brep.h:214
BREP_WING * prev
Definition Brep.h:211
friend BREP_VERTEX * AddVertex2Octree(BREP_VERTEX *vertex, OctreeNode *octree, bool dupli)
BREP_SOLID * solid
Definition Brep.h:294
friend BREP_VERTEX ** GetOctreeVertices(OctreeNode *octree, long int *vertexno)
BREP_VERTEX * vertex
ルートノードの場合は NULL
Definition Brep.h:297
friend long int OctreeGetter(OctreeNode *p, BREP_VERTEX **vtx, long int counter)
#define DllExport
Definition common.h:105
Definition Brep.h:29
DllExport BREP_WING * GetWingOtherSide(BREP_WING *wing)
Definition Brep.cpp:1028
DllExport BREP_EDGE * FindEdge(BREP_VERTEX *vertex1, BREP_VERTEX *vertex2)
Definition Brep.cpp:889
void freeBrepSolid(BREP_SOLID *&solid)
Definition Brep.h:105
DllExport void ConnectWingToVertex(BREP_WING *wing)
Definition Brep.cpp:802
std::list< BREP_WING * > BREP_WING_LIST
Definition Brep.h:46
std::list< BREP_EDGE * > BREP_EDGE_LIST
Definition Brep.h:45
DllExport TVector< double > Vertex2TVector(BREP_VERTEX *v)
Definition Brep.cpp:1036
DllExport BREP_EDGE * CreateEdge(BREP_VERTEX *v1, BREP_VERTEX *v2)
Definition Brep.cpp:988
std::list< BREP_VERTEX * > BREP_VERTEX_LIST
Definition Brep.h:47
DllExport BREP_VERTEX ** GetOctreeVertices(OctreeNode *octree, long int *vertexno)
Definition Brep.cpp:913
DllExport void DestroyWing(BREP_WING *wing)
Definition Brep.cpp:865
std::list< BREP_SHELL * > BREP_SHELL_LIST
Definition Brep.h:42
std::list< BREP_FACET * > BREP_FACET_LIST
Definition Brep.h:43
std::list< BREP_SOLID * > BREP_SOLID_LIST
Definition Brep.h:41
DllExport long int OctreeGetter(OctreeNode *p, BREP_VERTEX **vtx, long int counter)
Definition Brep.cpp:932
std::list< BREP_CONTOUR * > BREP_CONTOUR_LIST
Definition Brep.h:44
DllExport BREP_WING * CreateWingWithoutContour(BREP_VERTEX *vertex1, BREP_VERTEX *vertex2)
Definition Brep.cpp:817
DllExport BREP_VERTEX * AddVertex2Octree(BREP_VERTEX *vertex, OctreeNode *octree, bool dupli=false)
Definition Brep.cpp:971
DllExport int CompareVertex(BREP_VERTEX *v1, BREP_VERTEX *v2)
Definition Brep.cpp:1007