cgma
|
00001 /* 00002 * 00003 * 00004 * Copyright (C) 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 00005 * with Sandia Corporation, the U.S. Government retains certain rights in this software. 00006 * 00007 * This file is part of facetbool--contact via [email protected] 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 * 00023 * 00024 * 00025 */ 00026 00027 #ifndef _FACETEDBOOLEANRETRIANGULATE 00028 #define _FACETEDBOOLEANRETRIANGULATE 00029 #include <math.h> 00030 #include <vector> 00031 #include "FBDefines.hpp" 00032 #include "FBStructs.hpp" 00033 #include "CubitDefines.h" 00034 00035 class FBRetriangulate { 00036 00037 public: 00038 FBRetriangulate(std::vector<FB_Coord *>& my_verts, 00039 std::vector<FB_Triangle *>& my_tris, 00040 std::vector<int>& my_newfacets, 00041 std::vector<int>& my_newfacetsindex); 00042 00043 FBRetriangulate(std::vector<FB_Coord *>& my_verts, 00044 std::vector<FB_Triangle *>& my_tris, 00045 std::vector<int>& my_newfacets); 00046 00047 ~FBRetriangulate(); 00048 CubitStatus retriangulate_this_tri(int sequence, std::vector<FB_Edge*> &orphaned_edges); 00049 00050 private: 00051 std::vector<FB_Coord *> verts; 00052 std::vector<FB_Triangle *> *tris; 00053 std::vector<int> *newfacets; 00054 std::vector<int> *newfacetsindex; 00055 int p_dir, s_dir; 00056 enum WindingType { CCW = 0, CW = 1 }; 00057 WindingType winding; 00058 FB_Triangle *my_tri; 00059 std::vector<VertexStuff* > vertstufflist; 00060 void make_vert_list(); 00061 CubitStatus add_bdry_edges(std::vector<FB_Edge*> &orphaned_edges); 00062 inline double get_dist(double x0, double y0, double z0, 00063 double x1, double y1, double z1) { 00064 return sqrt( (x1-x0)*(x1-x0) + (y1-y0)*(y1-y0) + (z1-z0)*(z1-z0) ); 00065 }; 00066 CubitStatus remove_min_max(); 00067 void add_edge_up(int v0, int seq); 00068 void add_edge_down(int v0, int seq); 00069 bool test_for_crossing(int v0, int v1, int v2, int v3); 00070 void add_tri_edge(int v0, int v1, int v0_type, int v1_type); 00071 bool get_a_chain(std::vector<int> *chainlist); 00072 void sort_vertstufflist_edges(); 00073 void get_next_vert_in_chain(int& vthis, int& vprev, int direction); 00074 void add_this_bdry_edge(int v0, int v1, int v0_type, int v1_type); 00075 void classify_edges(); 00076 void get_edge_indices(int v0, int v1, int v2, int parent, 00077 int &e0index, int &e1index, int &e2index); 00078 00079 }; 00080 00081 #endif