cgma
|
#include <FaceterFacetData.hpp>
Public Member Functions | |
FaceterFacetData (CubitPoint *p1, CubitPoint *p2, CubitPoint *p3) | |
~FaceterFacetData () | |
virtual int | id () |
virtual void | set_id (int ii) |
void | owner (RefEntity *owner) |
RefEntity * | owner () |
SetDynamicMemoryAllocation (memoryManager) CubitStatus closest_point(const CubitVector &point | |
CubitPoint * | point (int index) |
void | set_point (CubitPoint *the_point, int index) |
CubitFacetEdge * | edge (int index) |
void | edge (CubitFacetEdge *the_edge, int index) |
void | edge_use (int direction, int index) |
int | edge_use (int index) |
CubitPoint * | split_edge (CubitPoint *edge_pt1, CubitPoint *edge_pt2, const CubitVector &position) |
CubitPoint * | insert_point (const CubitVector &position, CubitFacet *&new_tri1, CubitFacet *&new_tri2) |
void | flip () |
Public Attributes | |
CubitVector & | closest_point |
Private Attributes | |
CubitPoint * | pointArray [3] |
CubitFacetEdge * | edgeArray [3] |
int | edgeUse [3] |
int | entityId |
RefEntity * | myOwner |
Static Private Attributes | |
static MemoryManager | memoryManager |
Definition at line 17 of file FaceterFacetData.hpp.
FaceterFacetData::FaceterFacetData | ( | CubitPoint * | p1, |
CubitPoint * | p2, | ||
CubitPoint * | p3 | ||
) |
Definition at line 30 of file FaceterFacetData.cpp.
{ assert( p1 && p2 && p3 ); assert( p1 != p2 && p1 != p3 && p2 != p3 ); myOwner = NULL; pointArray[0] = p1; pointArray[1] = p2; pointArray[2] = p3; p1->add_facet(this); p2->add_facet(this); p3->add_facet(this); edgeArray[0] = NULL; edgeArray[1] = NULL; edgeArray[2] = NULL; edgeUse[0] = edgeUse[1] = edgeUse[2] = 0; patchCtrlPts = NULL; //CubitVector temp = normal(); //cachedNormal = new CubitVector(temp); plane(); counter_id++; entityId = counter_id; // define the bounding box CubitVector bbox_min, bbox_max; bbox_min.x(min3(p1->x(),p2->x(),p3->x())); bbox_min.y(min3(p1->y(),p2->y(),p3->y())); bbox_min.z(min3(p1->z(),p2->z(),p3->z())); bbox_max.x(max3(p1->x(),p2->x(),p3->x())); bbox_max.y(max3(p1->y(),p2->y(),p3->y())); bbox_max.z(max3(p1->z(),p2->z(),p3->z())); bBox.reset(bbox_min,bbox_max); }
Definition at line 74 of file FaceterFacetData.cpp.
{ }
CubitFacetEdge * FaceterFacetData::edge | ( | int | index | ) | [inline, virtual] |
Implements CubitFacet.
Definition at line 123 of file FaceterFacetData.hpp.
{ assert( (index >= 0) && (index < 3) ); if (!is_backwards()) return edgeArray[index]; else { switch(index) { case 0: return edgeArray[0]; case 1: return edgeArray[2]; case 2: return edgeArray[1]; } } return NULL; }
void FaceterFacetData::edge | ( | CubitFacetEdge * | the_edge, |
int | index | ||
) | [inline, virtual] |
Implements CubitFacet.
Definition at line 58 of file FaceterFacetData.hpp.
{ edgeArray[index] = the_edge; };
void FaceterFacetData::edge_use | ( | int | direction, |
int | index | ||
) | [inline, virtual] |
Implements CubitFacet.
Definition at line 62 of file FaceterFacetData.hpp.
{ edgeUse[index] = direction; };
int FaceterFacetData::edge_use | ( | int | index | ) | [inline, virtual] |
Implements CubitFacet.
Definition at line 140 of file FaceterFacetData.hpp.
{ assert( (index >= 0) && (index < 3) ); if (!is_backwards()) return edgeUse[index]; else { switch(index) { case 0: return -edgeUse[0]; case 1: return -edgeUse[2]; case 2: return -edgeUse[1]; } } return 0; }
void FaceterFacetData::flip | ( | ) | [virtual] |
Implements CubitFacet.
Definition at line 239 of file FaceterFacetData.cpp.
{ CubitPoint *pt_tmp = pointArray[1]; pointArray[1] = pointArray[2]; pointArray[2] = pt_tmp; CubitFacetEdge *ed_tmp = edgeArray[1]; edgeArray[1] = edgeArray[2]; edgeArray[2] = ed_tmp; for (int ii=0; ii<3; ii++) { if (edgeUse[ii] == -1) edgeUse[ii] = 1; else if(edgeUse[ii] == 1) edgeUse[ii] = -1; } if (cachedPlane) { CubitVector normal = cachedPlane->normal(); normal = -normal; cachedPlane->normal( normal ); } }
virtual int FaceterFacetData::id | ( | void | ) | [inline, virtual] |
CubitPoint * FaceterFacetData::insert_point | ( | const CubitVector & | position, |
CubitFacet *& | new_tri1, | ||
CubitFacet *& | new_tri2 | ||
) | [virtual] |
Reimplemented from CubitFacet.
Definition at line 174 of file FaceterFacetData.cpp.
{ if( DEBUG_FLAG(110 ) ) { GfxDebug::draw_facet(this, CUBIT_WHITE_INDEX); GfxDebug::flush(); } CubitPoint* new_point = (CubitPoint *) new CubitPointData( position ); new_tri1 = (CubitFacet *) new FaceterFacetData( pointArray[1], pointArray[2], new_point ); new_tri2 = (CubitFacet *) new FaceterFacetData( pointArray[2], pointArray[0], new_point ); pointArray[2]->remove_facet( this ); pointArray[2] = new_point; new_point->add_facet( this ); if( DEBUG_FLAG(110) ) { CubitVector temp_vector = new_point->coordinates(); GfxDebug::draw_facet(this, CUBIT_MAGENTA_INDEX); GfxDebug::flush(); GfxDebug::draw_facet(new_tri1, CUBIT_MAGENTA_INDEX); GfxDebug::flush(); GfxDebug::draw_facet(new_tri2, CUBIT_MAGENTA_INDEX); GfxDebug::flush(); GfxDebug::draw_point(temp_vector, CUBIT_CYAN_INDEX); GfxDebug::flush(); } if( cachedPlane && (cachedPlane->distance(position) > CUBIT_RESABS) ) { delete cachedPlane; cachedPlane = 0; } if (isBackwards) { new_tri1->is_backwards( 1 ); new_tri2->is_backwards( 1 ); } return new_point; }
void FaceterFacetData::owner | ( | RefEntity * | owner | ) | [inline] |
Definition at line 36 of file FaceterFacetData.hpp.
RefEntity* FaceterFacetData::owner | ( | ) | [inline] |
Definition at line 38 of file FaceterFacetData.hpp.
{return myOwner;}
CubitPoint * FaceterFacetData::point | ( | int | index | ) | [inline, virtual] |
Implements CubitFacet.
Definition at line 106 of file FaceterFacetData.hpp.
{ assert( (index >= 0) && (index < 3) ); if (!is_backwards()) return pointArray[index]; else { switch(index) { case 0: return pointArray[0]; case 1: return pointArray[2]; case 2: return pointArray[1]; } } return NULL; }
virtual void FaceterFacetData::set_id | ( | int | ii | ) | [inline, virtual] |
void FaceterFacetData::set_point | ( | CubitPoint * | the_point, |
int | index | ||
) | [inline] |
Definition at line 54 of file FaceterFacetData.hpp.
{ pointArray[index] = the_point; }
CubitPoint * FaceterFacetData::split_edge | ( | CubitPoint * | edge_pt1, |
CubitPoint * | edge_pt2, | ||
const CubitVector & | position | ||
) | [virtual] |
Reimplemented from CubitFacet.
Definition at line 122 of file FaceterFacetData.cpp.
{ CubitPointData* new_pt = new CubitPointData(position); // split triangles DLIList<CubitFacet*> facets; edge1_pt->shared_facets( edge2_pt, facets ); facets.reset(); for ( int i = facets.size(); i--; ) { CubitFacet* facet = facets.get_and_step(); FaceterFacetData* facet_d = dynamic_cast<FaceterFacetData*>(facet); assert(!!facet_d); // fix up existing facet int pt2_index = facet->point_index( edge2_pt ); bool edge_reversed = ( edge1_pt == facet->point( (pt2_index+1) % 3 ) ); int edge_index = (pt2_index + 2 - edge_reversed) % 3; facet->update_plane(); edge2_pt->remove_facet( facet ); facet_d->set_point( new_pt, pt2_index ); new_pt->add_facet( facet ); // make new facet CubitPoint* other_pt = facet->point( edge_index ); if ( edge_reversed ) new FaceterFacetData( other_pt, edge2_pt, new_pt ); else new FaceterFacetData( other_pt, new_pt, edge2_pt ); } return new_pt; }
Definition at line 43 of file FaceterFacetData.hpp.
CubitFacetEdge* FaceterFacetData::edgeArray[3] [private] |
Definition at line 21 of file FaceterFacetData.hpp.
int FaceterFacetData::edgeUse[3] [private] |
Definition at line 22 of file FaceterFacetData.hpp.
int FaceterFacetData::entityId [private] |
Definition at line 25 of file FaceterFacetData.hpp.
MemoryManager FaceterFacetData::memoryManager [static, private] |
Definition at line 23 of file FaceterFacetData.hpp.
RefEntity* FaceterFacetData::myOwner [private] |
Definition at line 26 of file FaceterFacetData.hpp.
CubitPoint* FaceterFacetData::pointArray[3] [private] |
Definition at line 20 of file FaceterFacetData.hpp.