cgma
|
00001 //------------------------------------------------------------------------- 00002 // Filename : ChordalAxis.hpp 00003 // 00004 // Purpose : 00005 // 00006 // Special Notes : 00007 // 00008 // Creator : Jit Ken Tan 00009 // 00010 // Creation Date : 09/02/02 00011 //------------------------------------------------------------------------- 00012 00013 #ifndef CHORDALAXIS_HPP 00014 #define CHORDALAXIS_HPP 00015 00016 #include "CubitDefines.h" 00017 #include "DLIList.hpp" 00018 #include "CubitMessage.hpp" 00019 #include "CubitFacet.hpp" 00020 #include "CubitFacetEdge.hpp" 00021 #include "CubitPoint.hpp" 00022 #include "GfxDebug.hpp" 00023 00024 class TDChordal; 00025 class CubitVector; 00026 class ChordalAxis 00027 { 00028 00029 public: 00030 00031 ChordalAxis(); 00032 00033 ~ChordalAxis(); 00034 00035 //- Perform the entire chordal axis extraction 00036 CubitStatus chordal_axis_transform(DLIList <CubitPoint*> boundary_loop_list,DLIList <CubitFacet *> &facet_list, DLIList <CubitFacetEdge *> &axis); 00037 00038 private: 00039 00040 //- create a delaunay constrained triangulation 00041 CubitStatus create_triangulation(DLIList <CubitPoint*> boundary_loop_list); 00042 00043 //- extract the chordal axis for a junction triangle 00044 CubitStatus junction_triangle(CubitFacet *current_facet, TDChordal * td_chordal, DLIList <CubitFacetEdge *> &axis); 00045 00046 //-Get circumcenter given 3 points of the circle 00047 CubitVector get_center(CubitVector v1, CubitVector v2, CubitVector v3); 00048 00049 //- Flag the boundary edges 00050 CubitStatus flagging_boundary(); 00051 00052 //- Flag a boundary edge 00053 CubitStatus flag_boundary( CubitFacet *curr_facet, CubitPoint *start_node, CubitPoint *end_node ); 00054 00055 //- Classified each triangle based on its boundary edges 00056 CubitStatus process_triangles(); 00057 00058 //- perform extraction 00059 CubitStatus axis_extraction( DLIList <CubitFacetEdge *> &axis ); 00060 00061 //- Obtain TDChordal Tool data 00062 TDChordal *get_tool_data(CubitFacet* curr_facet); 00063 00064 //- Perform chordal axis extraction given a sleeve triangle 00065 CubitStatus sleeve_triangle(CubitFacet* curr_facet,TDChordal* td_chordal, DLIList <CubitFacetEdge *> &axis); 00066 00067 //- Perform pruning of the chordal axis 00068 CubitStatus pruning(); 00069 00070 //- Searching for triangles to prune 00071 CubitStatus search_triangles_to_prune(CubitFacet *adj_triangle, CubitFacetEdge *curr_edge, CubitPoint *start_node, CubitVector unit_edge_vector, double pruning_distance, DLIList <CubitFacet *> &pruned_triangles, CubitStatus &prune ); 00072 00073 //- Pruning commences with the junction triangle 00074 CubitStatus junction_triangle_pruning(CubitFacet *curr_facet, int edge_index, bool &pruning_performed); 00075 00076 //- Mark Triangle as discarded 00077 CubitStatus mark_tri_discarded(CubitFacet *curr_facet); 00078 00079 //- Mark Triangle as visited 00080 CubitStatus mark_visited(CubitFacet *curr_facet); 00081 00082 //- Mark Triangle as unvisited 00083 CubitStatus unmark_visited(CubitFacet *curr_facet); 00084 00085 //- Check if the triangle is visited 00086 CubitStatus get_visited(CubitFacet *curr_facet, bool &visited); 00087 00088 //- Determine the triangle type based on the number of boundary edges 00089 CubitStatus determine_tritype(CubitFacet *curr_facet); 00090 00091 //- Consolidate the junction triangles in our mesh 00092 CubitStatus junction_tris_collection(); 00093 00094 //- for debugging purposes 00095 void debug_draw_facet(CubitFacet *curr_facet, int color){ 00096 DLIList<CubitFacetEdge *> edge_list; 00097 curr_facet->edges(edge_list); 00098 int ii; 00099 00100 for(ii =0; ii<edge_list.size(); ii++){ 00101 GfxDebug::draw_facet_edge(edge_list.get_and_step(), color); 00102 } 00103 00104 }; 00105 00106 //- for debugging purposes 00107 void print_point(CubitPoint *curr_point){ 00108 PRINT_INFO("Point = (%f, %f) \n", curr_point->x(), curr_point->y()); 00109 } 00110 00111 int numBoundaryEdges; 00112 CubitPoint **startNodes; 00113 CubitPoint **endNodes; 00114 DLIList <CubitFacet*> triangulation; 00115 DLIList <CubitFacet*> junctionTris; 00116 double pruningAlpha; 00117 }; 00118 00119 #endif 00120