BREP_CONTOUR Class Reference

#include <Brep.h>

Collaboration diagram for BREP_CONTOUR:
Collaboration graph
[legend]

List of all members.

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 169 of file Brep.h.


Constructor & Destructor Documentation

BREP_CONTOUR ( BREP_FACET pr_facet  ) 

Definition at line 328 of file Brep.cpp.

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.

00329 {
00330     facet = pr_facet;
00331     if (facet!=NULL) facet->ConnectContour(this);
00332     
00333     wing      = NULL;
00334     dup_edge  = 0;
00335     collision = false;
00336     hasCollisionVector = false;
00337 
00338     rbound.set(HUGE_VALF, -HUGE_VALF, HUGE_VALF, -HUGE_VALF, HUGE_VALF, -HUGE_VALF);
00339 }

Here is the call graph for this function:

~BREP_CONTOUR (  )  [virtual]

Definition at line 344 of file Brep.cpp.

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

00345 {
00346     if (facet!=NULL) facet->DisconnectContour(this);
00347     DestroyWings();
00348 }

Here is the call graph for this function:


Member Function Documentation

void CloseData ( void   ) 

Definition at line 352 of file Brep.cpp.

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

Referenced by jbxl::CreateContourByVertex().

00353 {
00354     ComputeNormal();
00355     if (!hasCollisionVector) ComputeDirectRS();
00356 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 460 of file Brep.cpp.

References 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.

00461 {
00462     if (wing==NULL) return;
00463 
00464     BREP_WING* next = wing;
00465     do {
00466         BREP_WING* swing = next;
00467         //
00468         double d = -(facet->normal * swing->vertex->point);
00469         if (d < dmin) dmin = d;
00470         if (d > dmax) dmax = d;
00471         if (swing->vertex->tolerance>emax) emax = swing->vertex->tolerance;
00472         facet->rbound.fusion(swing->vertex->point);
00473         //
00474         next = swing->next;
00475     } while (next!=wing);
00476 }

Here is the call graph for this function:

void ComputeDirectRS (  ) 

void BREP_CONTOUR::ComputeDirectRS()

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

Definition at line 507 of file Brep.cpp.

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().

00508 {
00509     TVector<double> point = Vertex2TVector(wing->next->vertex);
00510 
00511     directR  = point - Vertex2TVector(wing->vertex);
00512     directS  = Vertex2TVector(wing->next->next->vertex) - point;
00513     directRS = directR^directS;
00514     directR.norm();
00515     directS.norm();
00516     directRS.norm();
00517 
00518     hasCollisionVector = true;
00519 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ComputeNormal (  ) 

void BREP_CONTOUR::ComputeNormal()

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

Definition at line 485 of file Brep.cpp.

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().

00486 {
00487     normal = Vector<double>(0.0, 0.0, 0.0);
00488 
00489     Vector<double> next = wing->vertex->point;
00490     for (BREP_WING* swing=wing; swing; swing=(swing->next==wing ? NULL:swing->next)) {
00491         Vector<double> cur = next;
00492         next = swing->next->vertex->point;
00493         normal.x += (cur.y - next.y) * (cur.z + next.z);
00494         normal.y += (cur.z - next.z) * (cur.x + next.x);
00495         normal.z += (cur.x - next.x) * (cur.y + next.y);
00496     }
00497     normal.normalize();
00498 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ConnectWing ( BREP_WING new_wing  ) 

void BREP_CONTOUR::ConnectWing(BREP_WING* new_wing)

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

Definition at line 365 of file Brep.cpp.

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

Referenced by BREP_CONTOUR::CreateWing().

00366 {
00367     if (new_wing==NULL) return;
00368 
00369     new_wing->contour = this;
00370 
00371     if (wing==NULL) {   // 最初の Wing
00372         new_wing->next = new_wing->prev = new_wing;
00373         wing = new_wing;
00374     }
00375     else {              // 2番目以降の Wing
00376         new_wing->next = wing;
00377         new_wing->prev = wing->prev;
00378         new_wing->prev->next = new_wing->next->prev = new_wing;
00379     }
00380 }

Here is the caller graph for this function:

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 411 of file Brep.cpp.

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().

00412 {
00413     // 新しく作成するWingのスタートVertexは,一つ前のWingのエンドVertexと同一でなければならない.
00414     // つまり Wingは順序よく作成しなければならない.
00415     if (wing!=NULL && GetWingOtherSide(wing->prev)->vertex!=vertex1) {
00416         DEBUG_MODE PRINT_MESG("CreateWing: Irregular order of Wings!!\n");
00417         return NULL;
00418     }
00419 
00420     // vertex1をスタートVertexとしたWingを作る.すでに空のWingがある場合にはそれを返す.
00421     // vertex1==vertex2 の場合は NULLを返す.
00422     BREP_WING* wing = CreateWingWithoutContour(vertex1, vertex2);
00423     if (wing==NULL) return NULL;
00424 
00425     // WingをContourに登録
00426     ConnectWing(wing); 
00427     if (GetWingOtherSide(wing)->contour!=NULL) {    // 対応するEdgeは2つの参照されたWingを持つ完全なEdge
00428         wing->edge->complete = true;
00429     }
00430 
00431     // WingをスタートVertexのリングに登録
00432     (wing->vertex)->wing_list.push_back(wing); 
00433 
00434     return wing;
00435 }

Here is the call graph for this function:

Here is the caller graph for this function:

void DestroyWings (  ) 

void BREP_CONTOUR::DestroyWings()

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

Definition at line 444 of file Brep.cpp.

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

Referenced by BREP_CONTOUR::~BREP_CONTOUR().

00445 {
00446     BREP_WING* first = wing;
00447     if (first==NULL) return;
00448 
00449     BREP_WING* prev;
00450     for (BREP_WING* swing=first->prev; swing!=first; swing=prev) {
00451         prev = swing->prev;
00452         DestroyWing(swing);
00453     }
00454     DestroyWing(first);
00455 }

Here is the call graph for this function:

Here is the caller graph for this function:

void DisconnectWing ( BREP_WING wing  ) 

Definition at line 385 of file Brep.cpp.

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

Referenced by jbxl::DestroyWing().

00386 {
00387     if (wing==dis_wing) {
00388         if (dis_wing->next==dis_wing) {
00389             wing = NULL;
00390         }
00391         else {
00392             wing = dis_wing->next;
00393         }
00394     }
00395 
00396     if (dis_wing->next) dis_wing->next->prev = dis_wing->prev;
00397     if (dis_wing->prev) dis_wing->prev->next = dis_wing->next;
00398 
00399     dis_wing->contour = NULL;
00400     dis_wing->next = dis_wing->prev = NULL;
00401 }

Here is the caller graph for this function:


Member Data Documentation

bool collision

Definition at line 184 of file Brep.h.

Referenced by BREP_CONTOUR::BREP_CONTOUR().

TVector<double> directR
TVector<double> directRS
TVector<double> directS
int dup_edge

Definition at line 183 of file Brep.h.

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

Vector<double> normal

Definition at line 176 of file Brep.h.

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

RBound<double> rbound

Definition at line 175 of file Brep.h.

Referenced by BREP_CONTOUR::BREP_CONTOUR().


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

Generated on 15 Nov 2023 for JunkBox_Lib++ (for Windows) by  doxygen 1.6.1