cgma
|
00001 //-Class: BoundaryContstrainTool 00002 //-Description: recover edges from a triangle mesh. Currently 2D meshes only 00003 //-Owner: Steve Owen 00004 //-Altered by: Jit Ken Tan (07/08/02) 00005 //-Checked by: 00006 00007 #ifndef BOUNDARY_CONSTRAIN_TOOL_HPP 00008 #define BOUNDARY_CONSTRAIN_TOOL_HPP 00009 00010 #include "DLIList.hpp" 00011 class CubitVector; 00012 00013 typedef enum SwapStatus { SWAP_FAILURE, SWAP_SUCCESS, SWAP_INVALID } SwapStatus; 00014 typedef enum IntersectionType { AT_BEGIN, AT_EDGE, AT_MID, AT_END, NO_ISECT } IntersectionType; 00015 00016 template <class SURF, class TRI, class EDGE, class NODE, class TRICHILD> class BoundaryConstrainTool 00017 { 00018 private: 00019 DLIList <TRI *> *facetList; 00020 SURF *refFacePtr; 00021 double zeroTol; 00022 DLIList<EDGE *> edgeCrossQueue; 00023 00024 CubitStatus get_crossing_edges( CubitVector &edge_vec, 00025 NODE *n0_ptr, 00026 NODE *n1_ptr); 00027 //- generate the initial list of all edges that cross the edge_vec 00028 //- between n0 and n1 00029 00030 IntersectionType intersect_from_node(CubitVector &edge_vec, 00031 NODE *n0_ptr, 00032 TRI *&tri_ptr, 00033 EDGE *&edge_ptr, 00034 NODE *&node_ptr ); 00035 //- determine next intersection assuming start from n0 00036 00037 IntersectionType intersect_from_edge( CubitVector &edge_vec, 00038 NODE *n0_ptr, 00039 NODE *n1_ptr, 00040 TRI *&tri_ptr, 00041 EDGE *&edge_ptr, 00042 NODE *&node_ptr ); 00043 //- determine next intersection assuming start from edge_ptr 00044 00045 CubitStatus node_at_mid( CubitVector &edge_vec, 00046 TRI *tri_ptr, 00047 NODE *node_ptr ); 00048 //- he vector hit a node on its way to the n1 00049 00050 SwapStatus swap_edge( EDGE *&edge_ptr ); 00051 //- attempt to swap a single edge. Check for valid swap 00052 //- before doing so 00053 00054 CubitStatus edge_intersected( CubitVector &edge_vec, 00055 EDGE *edge_ptr, 00056 NODE *n0_ptr, 00057 NODE *n1_ptr ); 00058 //- check to see if the edge we just generated crosses the 00059 //- edge_vec. If so, then add it to the queue 00060 00061 public: 00062 BoundaryConstrainTool(); 00063 BoundaryConstrainTool(SURF *ref_face_ptr); 00064 ~BoundaryConstrainTool(); 00065 //- constructor and desructor 00066 00067 CubitStatus recover_edge(NODE *n0_ptr,NODE *n1_ptr, 00068 EDGE *&recovered_edge_ptr, 00069 DLIList <TRI *> *facet_list); 00070 00071 //- flip edges in the triangulation to recover the edge between 00072 //- n0_ptr and n1_ptr. Assumes 2D (x-y-0) 00073 }; 00074 00075 #include "BoundaryConstrainTool.cpp" 00076 00077 #endif 00078