cgma
|
00001 //----------------------------------------------------------------------------- 00002 // 00003 // File: FaceterPointData.hpp 00004 // 00005 // Purpose: Child class of CubitPoint. It is the Cubit-specific version of 00006 // of the CubitPoint. 00007 // 00008 // Notes: Note that this class contains data which is accessed 00009 // virtually from CubitPoint. In most cases, you can create 00010 // a FaceterPointData and treat it as if it is a CubitPoint. 00011 // For example: 00012 // CubitPoint *cp = (CubitPoint *) new FaceterPointData(...); 00013 // There should be no reason to reference the CubitFacetPoint 00014 // directly. This is done to allow different data representations 00015 // of a point in addition to that used by Cubit. 00016 // 00017 //----------------------------------------------------------------------------- 00018 00019 00020 #ifndef FACETERPOINTDATA_HPP 00021 #define FACETERPOINTDATA_HPP 00022 00023 // Include for CubitBoolean 00024 #include "CubitDefines.h" 00025 #include "CubitVector.hpp" 00026 #include "DLIList.hpp" 00027 #include "MemoryManager.hpp" 00028 #include "ToolDataUser.hpp" 00029 #include "CubitMatrix.hpp" 00030 #include "CubitPoint.hpp" 00031 class CubitFacet; 00032 class RefEntity; 00033 00034 class FaceterPointData : public CubitPoint 00035 { 00036 private: 00037 00038 CubitVector coords; 00039 DLIList<CubitFacet*> *attachedFacets; 00040 RefEntity *myOwner; 00041 FaceterPointData *mNext, *mPrev; 00042 double myInteriorAngle; 00043 00044 static MemoryManager memoryManager; 00045 //- memory management object 00046 00047 int entityId; 00048 00049 public: 00050 00051 FaceterPointData(double x_val, double y_val, double z_val ); 00052 FaceterPointData( const CubitVector &new_point ); 00053 ~FaceterPointData(); 00054 00055 SetDynamicMemoryAllocation(memoryManager) 00056 //- class specific new and delete operators 00057 00058 int id(){ return entityId;} 00059 00060 //The following functions are used for sorting FaceterPointData 00061 //based on their interior angle. 00062 static int sort_by_angle ( FaceterPointData *&pt_1, 00063 FaceterPointData *&pt_2); 00064 void set_interior_angle(double angle) 00065 {myInteriorAngle = angle;} 00066 double get_interior_angle() 00067 {return myInteriorAngle;} 00068 void set_prev(FaceterPointData *prev) 00069 {mPrev = prev;} 00070 FaceterPointData* get_prev() 00071 {return mPrev;} 00072 void set_next(FaceterPointData *next) 00073 {mNext = next;} 00074 FaceterPointData* get_next() 00075 {return mNext;} 00076 00077 00078 00079 double x(){return coords.x();} 00080 double y(){return coords.y();} 00081 double z(){return coords.z();} 00082 void set( const CubitVector &pos ) { coords = pos; } 00083 00084 void marked(int marked){ markedFlag = marked;} 00085 int marked(){return markedFlag;} 00086 //- generic marker for efficient sorting. 00087 00088 CubitVector coordinates() const { return coords; } 00089 void coordinates(double point_array[3]); 00090 void owner(RefEntity* my_owner) 00091 {myOwner = my_owner;} 00092 RefEntity* owner() 00093 {return myOwner;} 00094 void add_facet( CubitFacet *facet); 00095 void remove_facet( CubitFacet *facet ); 00096 int num_adj_facets(); 00097 00098 void facets( DLIList<CubitFacet*> &facet_list) 00099 { if (attachedFacets) facet_list += *attachedFacets; } 00100 void edges( DLIList<CubitFacetEdge*> &edge_list); 00101 void points( DLIList<CubitPoint*> &point_list ) 00102 { point_list.append( this ); } 00103 00104 void compute_avg_normal(); 00105 }; 00106 00107 #endif