JunkBox_Lib++ (for Windows) 1.10.1
Loading...
Searching...
No Matches
BREP_CONTOUR Class Reference

#include <Brep.h>

Collaboration diagram for BREP_CONTOUR:

Public Member Functions

 BREP_CONTOUR (BREP_FACET *pr_facet)
 
virtual ~BREP_CONTOUR ()
 
void CloseData ()
 
void ConnectWing (BREP_WING *wing)
 
void DisconnectWing (BREP_WING *wing)
 
void DestroyWings ()
 
void CloseFacet (BREP_FACET *facet, double &emax, double &dmin, double &dmax)
 
void ComputeNormal ()
 
void ComputeDirectRS ()
 
BREP_WINGCreateWing (BREP_VERTEX *vertex1, BREP_VERTEX *vertex2)
 

Public Attributes

BREP_FACETfacet
 
BREP_WINGwing
 
RBound< double > rbound
 
Vector< double > normal
 
TVector< double > directR
 △QRS 三角Contour衝突検出用
 
TVector< double > directS
 
TVector< double > directRS
 
int dup_edge
 多重エッジの数.
 
bool collision
 
bool hasCollisionVector
 

Detailed Description

Definition at line 167 of file Brep.h.

Constructor & Destructor Documentation

◆ BREP_CONTOUR()

BREP_CONTOUR ( BREP_FACET * pr_facet)

Definition at line 309 of file Brep.cpp.

310{
311 facet = pr_facet;
312 if (facet!=NULL) facet->ConnectContour(this);
313
314 wing = NULL;
315 dup_edge = 0;
316 collision = false;
317 hasCollisionVector = false;
318
319 rbound.set(HUGE_VALF, -HUGE_VALF, HUGE_VALF, -HUGE_VALF, HUGE_VALF, -HUGE_VALF);
320}
int dup_edge
多重エッジの数.
Definition Brep.h:181
BREP_FACET * facet
Definition Brep.h:170
BREP_WING * wing
Definition Brep.h:171
RBound< double > rbound
Definition Brep.h:173
bool hasCollisionVector
Definition Brep.h:183
void ConnectContour(BREP_CONTOUR *contour)
Definition Brep.cpp:250
void set(T XMin=(T) 0, T XMax=(T) 0, T YMin=(T) 0, T YMax=(T) 0, T ZMin=(T) 0, T ZMax=(T) 0, T TMin=(T) 0, T TMax=(T) 0)
Definition Vector.h:444

References BREP_CONTOUR::collision, BREP_FACET::ConnectContour(), BREP_CONTOUR::dup_edge, BREP_CONTOUR::facet, BREP_CONTOUR::hasCollisionVector, BREP_CONTOUR::rbound, RBound< T >::set(), and BREP_CONTOUR::wing.

Here is the call graph for this function:

◆ ~BREP_CONTOUR()

~BREP_CONTOUR ( )
virtual

Definition at line 324 of file Brep.cpp.

325{
326 if (facet!=NULL) facet->DisconnectContour(this);
327 DestroyWings();
328}
void DestroyWings()
Definition Brep.cpp:419
void DisconnectContour(BREP_CONTOUR *contour)
Definition Brep.cpp:259

References BREP_CONTOUR::DestroyWings(), BREP_FACET::DisconnectContour(), and BREP_CONTOUR::facet.

Here is the call graph for this function:

Member Function Documentation

◆ CloseData()

void CloseData ( )

Definition at line 331 of file Brep.cpp.

332{
335}
void ComputeDirectRS()
Definition Brep.cpp:479
void ComputeNormal()
Definition Brep.cpp:458

References BREP_CONTOUR::ComputeDirectRS(), BREP_CONTOUR::ComputeNormal(), and BREP_CONTOUR::hasCollisionVector.

Referenced by jbxl::CreateContourByVertex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CloseFacet()

void CloseFacet ( BREP_FACET * facet,
double & emax,
double & dmin,
double & dmax )

Definition at line 434 of file Brep.cpp.

435{
436 if (wing==NULL) return;
437
438 BREP_WING* next = wing;
439 do {
440 BREP_WING* swing = next;
441 //
442 double d = -(facet->normal * swing->vertex->point);
443 if (d < dmin) dmin = d;
444 if (d > dmax) dmax = d;
445 if (swing->vertex->tolerance>emax) emax = swing->vertex->tolerance;
446 facet->rbound.fusion(swing->vertex->point);
447 //
448 next = swing->next;
449 } while (next!=wing);
450}
Vector< double > normal
Definition Brep.h:141
RBound< double > rbound
Definition Brep.h:142
Vector< double > point
頂点の座標.
Definition Brep.h:260
double tolerance
Definition Brep.h:270
BREP_WING * next
Definition Brep.h:212
BREP_VERTEX * vertex
Start of Vertex.
Definition Brep.h:210
void fusion(RBound< T > bound)
境界構造体 bound と融合させる
Definition Vector.h:483

References BREP_CONTOUR::facet, RBound< T >::fusion(), BREP_WING::next, BREP_FACET::normal, BREP_VERTEX::point, BREP_FACET::rbound, BREP_VERTEX::tolerance, BREP_WING::vertex, and BREP_CONTOUR::wing.

Here is the call graph for this function:

◆ ComputeDirectRS()

void ComputeDirectRS ( )

void BREP_CONTOUR::ComputeDirectRS()

衝突判定用ベクトルの計算

Definition at line 479 of file Brep.cpp.

480{
482
483 directR = point - Vertex2TVector(wing->vertex);
486 directR.norm();
487 directS.norm();
488 directRS.norm();
489
490 hasCollisionVector = true;
491}
TVector< double > directRS
Definition Brep.h:179
TVector< double > directS
Definition Brep.h:178
TVector< double > directR
△QRS 三角Contour衝突検出用
Definition Brep.h:177
double norm(void)
Definition Vector.h:71
DllExport TVector< double > Vertex2TVector(BREP_VERTEX *v)
Definition Brep.cpp:1036

References BREP_CONTOUR::directR, BREP_CONTOUR::directRS, BREP_CONTOUR::directS, BREP_CONTOUR::hasCollisionVector, BREP_WING::next, Vector< T >::norm(), BREP_WING::vertex, jbxl::Vertex2TVector(), and BREP_CONTOUR::wing.

Referenced by BREP_CONTOUR::CloseData(), and jbxl::IsCollisionContours().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeNormal()

void ComputeNormal ( )

void BREP_CONTOUR::ComputeNormal()

Newells method により面の法線ベクトルを計算する.

Definition at line 458 of file Brep.cpp.

459{
460 normal = Vector<double>(0.0, 0.0, 0.0);
461
463 for (BREP_WING* swing=wing; swing; swing=(swing->next==wing ? NULL:swing->next)) {
464 Vector<double> cur = next;
465 next = swing->next->vertex->point;
466 normal.x += (cur.y - next.y) * (cur.z + next.z);
467 normal.y += (cur.z - next.z) * (cur.x + next.x);
468 normal.z += (cur.x - next.x) * (cur.y + next.y);
469 }
471}
Vector< double > normal
Definition Brep.h:174
Vector< T > normalize(void)
Definition Vector.h:87

References BREP_WING::next, BREP_CONTOUR::normal, Vector< T >::normalize(), BREP_VERTEX::point, BREP_WING::vertex, BREP_CONTOUR::wing, Vector< T >::x, Vector< T >::y, and Vector< T >::z.

Referenced by BREP_CONTOUR::CloseData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConnectWing()

void ConnectWing ( BREP_WING * new_wing)

void BREP_CONTOUR::ConnectWing(BREP_WING* new_wing)

新しい Wingを Contourのリストに追加する.

Definition at line 343 of file Brep.cpp.

344{
345 if (new_wing==NULL) return;
346
347 new_wing->contour = this;
348
349 if (wing==NULL) { // 最初の Wing
350 new_wing->next = new_wing->prev = new_wing;
351 wing = new_wing;
352 }
353 else { // 2番目以降の Wing
354 new_wing->next = wing;
355 new_wing->prev = wing->prev;
356 new_wing->prev->next = new_wing->next->prev = new_wing;
357 }
358}
BREP_CONTOUR * contour
Definition Brep.h:215
BREP_WING * prev
Definition Brep.h:211

References BREP_WING::contour, BREP_WING::next, BREP_WING::prev, and BREP_CONTOUR::wing.

Referenced by BREP_CONTOUR::CreateWing().

Here is the caller graph for this function:

◆ CreateWing()

BREP_WING * CreateWing ( BREP_VERTEX * vertex1,
BREP_VERTEX * vertex2 )

BREP_WING* BREP_CONTOUR::CreateWing(BREP_VERTEX* vertex1, BREP_VERTEX* vertex2)

vertex1をスタートVertexとした,Contour,Vertexに関連付けられらたWingを作る(必要なら新しいEdgeも).
作成時,指定するVertexは順序付けられていなければエラーとなる.

Definition at line 387 of file Brep.cpp.

388{
389 // 新しく作成するWingのスタートVertexは,一つ前のWingのエンドVertexと同一でなければならない.
390 // つまり Wingは順序よく作成しなければならない.
391 if (wing!=NULL && GetWingOtherSide(wing->prev)->vertex!=vertex1) {
392 DEBUG_MODE PRINT_MESG("CreateWing: Irregular order of Wings!!\n");
393 return NULL;
394 }
395
396 // vertex1をスタートVertexとしたWingを作る.すでに空のWingがある場合にはそれを返す.
397 // vertex1==vertex2 の場合は NULLを返す.
398 BREP_WING* wing = CreateWingWithoutContour(vertex1, vertex2);
399 if (wing==NULL) return NULL;
400
401 // WingをContourに登録
403 if (GetWingOtherSide(wing)->contour!=NULL) { // 対応するEdgeは2つの参照されたWingを持つ完全なEdge
404 wing->edge->complete = true;
405 }
406
407 // WingをスタートVertexのリングに登録
408 (wing->vertex)->wing_list.push_back(wing);
409
410 return wing;
411}
void ConnectWing(BREP_WING *wing)
Definition Brep.cpp:343
bool complete
完全なエッジ.2つの Wingは共に使用されている.
Definition Brep.h:239
BREP_EDGE * edge
Definition Brep.h:214
DllExport BREP_WING * GetWingOtherSide(BREP_WING *wing)
Definition Brep.cpp:1028
DllExport BREP_WING * CreateWingWithoutContour(BREP_VERTEX *vertex1, BREP_VERTEX *vertex2)
Definition Brep.cpp:817
#define PRINT_MESG(...)
環境依存用の出力関数.MS Windows用は未実装
Definition tools.h:469
#define DEBUG_MODE
Definition tools.h:502

References BREP_EDGE::complete, BREP_CONTOUR::ConnectWing(), jbxl::CreateWingWithoutContour(), DEBUG_MODE, BREP_WING::edge, jbxl::GetWingOtherSide(), BREP_WING::prev, PRINT_MESG, BREP_WING::vertex, and BREP_CONTOUR::wing.

Referenced by jbxl::CreateContourByVertex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DestroyWings()

void DestroyWings ( )

void BREP_CONTOUR::DestroyWings()

Contourに関連付けられた Wingをすべて破棄する.

Definition at line 419 of file Brep.cpp.

420{
421 BREP_WING* first = wing;
422 if (first==NULL) return;
423
424 BREP_WING* prev;
425 for (BREP_WING* swing=first->prev; swing!=first; swing=prev) {
426 prev = swing->prev;
427 DestroyWing(swing);
428 }
429 DestroyWing(first);
430}
DllExport void DestroyWing(BREP_WING *wing)
Definition Brep.cpp:865

References jbxl::DestroyWing(), BREP_WING::prev, and BREP_CONTOUR::wing.

Referenced by BREP_CONTOUR::~BREP_CONTOUR().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisconnectWing()

void DisconnectWing ( BREP_WING * wing)

Definition at line 362 of file Brep.cpp.

363{
364 if (wing==dis_wing) {
365 if (dis_wing->next==dis_wing) {
366 wing = NULL;
367 }
368 else {
369 wing = dis_wing->next;
370 }
371 }
372
373 if (dis_wing->next) dis_wing->next->prev = dis_wing->prev;
374 if (dis_wing->prev) dis_wing->prev->next = dis_wing->next;
375
376 dis_wing->contour = NULL;
377 dis_wing->next = dis_wing->prev = NULL;
378}

References BREP_WING::contour, BREP_WING::next, BREP_WING::prev, and BREP_CONTOUR::wing.

Referenced by jbxl::DestroyWing().

Here is the caller graph for this function:

Member Data Documentation

◆ collision

bool collision

Definition at line 182 of file Brep.h.

Referenced by BREP_CONTOUR::BREP_CONTOUR().

◆ directR

◆ directRS

◆ directS

◆ dup_edge

int dup_edge

Definition at line 181 of file Brep.h.

Referenced by BREP_CONTOUR::BREP_CONTOUR(), and jbxl::DupEdgeNumber().

◆ facet

◆ hasCollisionVector

bool hasCollisionVector

◆ normal

Vector<double> normal

Definition at line 174 of file Brep.h.

Referenced by BREP_CONTOUR::ComputeNormal(), and jbxl::println_FacetAsciiSTL().

◆ rbound

RBound<double> rbound

Definition at line 173 of file Brep.h.

Referenced by BREP_CONTOUR::BREP_CONTOUR().

◆ wing


The documentation for this class was generated from the following files: