cgma
|
#include <PST_Data.hpp>
Public Member Functions | |
const CubitPlane & | plane () |
CubitVector | normal () |
double | bounding_length () |
PST_CoEdge * | first_coedge () |
void | append_points (DLIList< PST_Point * > &result_list) |
PST_Point * | opposite (PST_Edge *edge) |
PST_Edge * | opposite (PST_Point *point) |
bool | two_edges (PST_Point *point, PST_Edge *&edge1, PST_Edge *&edge2) |
bool | modified () |
void | modified (bool b) |
void | debug_draw (int color=1, bool flush=true) |
int | validate (CubitBoolean print=CUBIT_FALSE) |
void | print () |
Static Public Member Functions | |
static void | debug_draw_faces (DLIList< PST_Face * > &list, int color, bool flush=true) |
Public Attributes | |
int | mark |
int | sequence |
int | parent |
Private Member Functions | |
PST_Face (PST_CoEdge *coedge) | |
PST_Face (PST_CoEdge *coedge, PST_Face *split_from) | |
~PST_Face () | |
bool | calculate_plane () |
Private Attributes | |
PST_CoEdge * | coedge_ |
CubitPlane | plane_ |
cBit | modified_: 1 |
cBit | update_plane_: 1 |
cBit | private_mark_: 1 |
Friends | |
class | PST_Edge |
class | PST_Point |
Definition at line 369 of file PST_Data.hpp.
PST_Face::PST_Face | ( | PST_CoEdge * | coedge | ) | [inline, private] |
Definition at line 425 of file PST_Data.hpp.
: mark(0), sequence(0), parent(0), coedge_(coedge), //boundary_(0), modified_(0), update_plane_(1), private_mark_(false) { }
PST_Face::PST_Face | ( | PST_CoEdge * | coedge, |
PST_Face * | split_from | ||
) | [inline, private] |
Definition at line 435 of file PST_Data.hpp.
: mark(0), sequence(0), parent(0), coedge_(coedge), //boundary_(split_from->boundary()), modified_(0), update_plane_(1), private_mark_(false) { split_from->modified(true); }
PST_Face::~PST_Face | ( | ) | [inline, private] |
Definition at line 444 of file PST_Data.hpp.
{ assert( !coedge_ ); }
void PST_Face::append_points | ( | DLIList< PST_Point * > & | result_list | ) |
Definition at line 88 of file PST_Data.cpp.
{ PST_CoEdge* ce = coedge_; #ifndef NDEBUG int debug = 0; #endif do { result_list.append( ce->end_point() ); ce = ce->next(); #ifndef NDEBUG assert( ++debug < PST_MAX_LIST_LEN ); #endif } while( ce != coedge_ ); }
double PST_Face::bounding_length | ( | ) | [inline] |
Definition at line 574 of file PST_Data.hpp.
{ // The coedges appear to be stored in a circular list so // get the length of the first edge and then iterate PST_CoEdge* coe = this->first_coedge(); CubitVector pos1 = coe->start_coord(); CubitVector pos2 = coe->end_coord(); CubitVector dist = pos1 - pos2; double length = dist.length_squared(); // start the chain at the next coedge coe = coe->next(); // walk through the coedges till we get back to the first // and find the minimum length edge double l; for ( ; coe != this->first_coedge(); coe = coe->next() ) { pos1 = coe->start_coord(); pos2 = coe->end_coord(); dist = pos1 - pos2; l = dist.length_squared(); if ( l < length) length = l; } return sqrt(length); }
bool PST_Face::calculate_plane | ( | ) | [private] |
Definition at line 172 of file PST_Data.cpp.
{ update_plane_ = 0; // Use Newell's method CubitVector dif, sum, ref(0.,0.,0.); CubitVector norm(0.,0.,0.); // For each coedge... PST_CoEdge* ce = coedge_; int count = 0; do { count++; const CubitVector& pt1 = ce->start_coord(); const CubitVector& pt2 = ce->end_coord(); dif = pt2 - pt1; sum = pt2 + pt1; ref += pt1; norm += CubitVector( dif.y()*sum.z(), dif.z()*sum.x(), dif.x()*sum.y() ); ce = ce->next(); assert( count < PST_MAX_LIST_LEN ); } while( ce != coedge_ ); // Degenerate? double len = norm.length(); if( len > CUBIT_RESABS ) { double d = (ref % norm) / (count * len); norm /= -len; //reverse and normalize plane_.normal( norm ); plane_.coefficient( d ); return true; } else { plane_.normal( CubitVector(0.,0.,0.) ); plane_.coefficient( 0. ); return false; } }
void PST_Face::debug_draw | ( | int | color = 1 , |
bool | flush = true |
||
) |
Definition at line 629 of file PST_Data.cpp.
{ PST_CoEdge* coedge = first_coedge(); do { coedge->edge()->debug_draw( color, false ); coedge = coedge->next(); } while( coedge != first_coedge() ); if( flush ) GfxDebug::flush(); }
void PST_Face::debug_draw_faces | ( | DLIList< PST_Face * > & | list, |
int | color, | ||
bool | flush = true |
||
) | [static] |
Definition at line 895 of file PST_Data.cpp.
{ for( int f = face_list.size(); f--; ) face_list.get_and_step()->debug_draw( color, false ); if( flush ) GfxDebug::flush(); }
PST_CoEdge* PST_Face::first_coedge | ( | ) | [inline] |
Definition at line 389 of file PST_Data.hpp.
{ return coedge_; }
bool PST_Face::modified | ( | ) | [inline] |
Definition at line 400 of file PST_Data.hpp.
{ return modified_; }
void PST_Face::modified | ( | bool | b | ) | [inline] |
Definition at line 403 of file PST_Data.hpp.
{ modified_ = b; if( b ) update_plane_ = 1; }
CubitVector PST_Face::normal | ( | ) | [inline] |
Definition at line 383 of file PST_Data.hpp.
PST_Point * PST_Face::opposite | ( | PST_Edge * | edge | ) |
Definition at line 105 of file PST_Data.cpp.
{ PST_CoEdge* ce = coedge_; #ifndef NDEBUG int debug = 0; #endif do { if( ce->edge() == edge ) return ce->next()->end_point(); ce = ce->next(); #ifndef NDEBUG assert( ++debug < PST_MAX_LIST_LEN ); #endif } while( ce != coedge_ ); return 0; }
PST_Edge * PST_Face::opposite | ( | PST_Point * | point | ) |
Definition at line 125 of file PST_Data.cpp.
{ PST_CoEdge* ce = coedge_; #ifndef NDEBUG int debug = 0; #endif do { if( ce->start_point() == point ) return ce->next()->edge(); ce = ce->next(); #ifndef NDEBUG assert( ++debug < PST_MAX_LIST_LEN ); #endif } while( ce != coedge_ ); return 0; }
const CubitPlane& PST_Face::plane | ( | ) | [inline] |
Definition at line 376 of file PST_Data.hpp.
{ if( update_plane_ ) calculate_plane(); return plane_; }
void PST_Face::print | ( | ) |
Definition at line 1211 of file PST_Data.cpp.
{ if( ! coedge_ ) { PRINT_ERROR("Face %p has null coedge.\n", (void*)this); return; } PRINT_INFO("Face CoEdge Edge Start Pt End Pt\n" "---------- ----------- ----------- ----------- -----------\n" ); PST_CoEdge* coe = coedge_; PRINT_INFO("%10p %10p %10p %10p %10p\n", (void*)this, (void*)coe, (void*)coe->edge(), (void*)coe->start_point(), (void*)coe->end_point() ); coe = coe->next(); while( coe && coe != coedge_ ) { PRINT_INFO(" %10p %10p %10p %10p\n", (void*)coe, (void*)coe->edge(), (void*)coe->start_point(), (void*)coe->end_point() ); coe = coe->next(); } }
bool PST_Face::two_edges | ( | PST_Point * | point, |
PST_Edge *& | edge1, | ||
PST_Edge *& | edge2 | ||
) |
Definition at line 145 of file PST_Data.cpp.
{ e1 = e2 = 0; PST_CoEdge* ce = coedge_; #ifndef NDEBUG int debug = 0; #endif do { if( ce->end_point() == point ) { if( e1 || e2 ) return false; e1 = ce->edge(); e2 = ce->next()->edge(); } ce = ce->next(); #ifndef NDEBUG assert( ++debug < PST_MAX_LIST_LEN ); #endif } while( ce != coedge_ ); return e1 && e2; }
int PST_Face::validate | ( | CubitBoolean | print = CUBIT_FALSE | ) |
Definition at line 1145 of file PST_Data.cpp.
{ PST_CoEdge* coe = coedge_; if( !coedge_ ) { if(print) PRINT_ERROR("Face %p has null loop.\n", (void*)this); return 1; } int count = 0; int result = 0; do { if( count++ > PST_MAX_LIST_LEN ) { if( print ) PRINT_ERROR("Face %p loop is infinite.\n", (void*)this); result++; break; } if( coe->face() != this ) { if( print ) PRINT_ERROR("Loop for face %p contains face %p on edge %p.\n", (void*)this, (void*)coe->face(), (void*)coe->edge() ); result++; } if( coe->edge() ) { result += coe->edge()->validate( print ); } else { if( print ) PRINT_ERROR("Coedge %p in face %p has null edge.\n", (void*)coe, (void*)this); result++; } if( ! coe->next() ) { if( print ) PRINT_ERROR("Null coedge after coedge %p in face %p.\n", (void*)coe, (void*)this ); result++; break; } coe = coe->next(); } while( coe != coedge_ ); return result; }
friend class PST_Edge [friend] |
Definition at line 371 of file PST_Data.hpp.
friend class PST_Point [friend] |
Definition at line 372 of file PST_Data.hpp.
PST_CoEdge* PST_Face::coedge_ [private] |
Definition at line 449 of file PST_Data.hpp.
int PST_Face::mark |
Definition at line 417 of file PST_Data.hpp.
cBit PST_Face::modified_ [private] |
Definition at line 453 of file PST_Data.hpp.
int PST_Face::parent |
Definition at line 421 of file PST_Data.hpp.
CubitPlane PST_Face::plane_ [private] |
Definition at line 450 of file PST_Data.hpp.
cBit PST_Face::private_mark_ [private] |
Definition at line 455 of file PST_Data.hpp.
Definition at line 419 of file PST_Data.hpp.
cBit PST_Face::update_plane_ [private] |
Definition at line 454 of file PST_Data.hpp.