cgma
FBTiler.hpp
Go to the documentation of this file.
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 cubit@sandia.gov
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 _FACETEDBOOLEANTILER
00028 #define _FACETEDBOOLEANTILER
00029 #include "CubitDefines.h"
00030 
00031 #include "FBDefines.hpp"
00032 #include "FBStructs.hpp"
00033 
00034 class FBTilerChainVert {
00035 
00036 public:
00037   FBTilerChainVert(int v_0, int which_chain) {
00038     v0 = v_0;
00039     whichchain = which_chain;
00040   
00041   }
00042   ~FBTilerChainVert() { };
00043   int v0;
00044   int whichchain;
00045 };
00046 
00047 class FBTiler {
00048 
00049 public:
00050 
00051   FBTiler(std::vector<FB_Coord *>& my_verts, int pd, int sd, int sequence,
00052           double a, double b, double c,
00053           std::vector<int> *tri_list);
00054   ~FBTiler();
00055   CubitStatus Tile_Poly(std::vector<int> *coordlist);
00056   
00057 private:
00058 
00059   int p_dir;
00060   int s_dir;
00061   int parent;
00062   double xnorm, ynorm, znorm;
00063   std::vector<FB_Coord *> verts;
00064   std::vector<int> *my_tri_list;  
00065   int add_triangle(int v1, int v2, int v3);
00066 //  bool reflex_angle(int v0, int v1, int v2, int v1chain);
00067   bool reflex_angle(int v0, int v1, int v2, std::vector<int> *coordlist);
00068   std::vector<FBTilerChainVert*> sortedchainlist;
00069   CubitStatus retriangulate(std::vector<int> *coordlist);
00070   void dud_from_coord_list(int val, std::vector<int> *ivec);
00071   inline void decrement_list_ptr(std::vector<int>::iterator& it,
00072          std::vector<int>::iterator itbegin,  
00073          std::vector<int>::iterator itend)
00074   {
00075     if ( it == itbegin ) it = itend-1;
00076     else it--;
00077   }
00078 
00079   inline void increment_list_ptr(std::vector<int>::iterator& it,
00080          std::vector<int>::iterator itbegin,  
00081          std::vector<int>::iterator itend)
00082   {
00083     it++;
00084     if ( it == itend ) it = itbegin;
00085   }
00086 
00087   inline int get_adjacency(int top, int thisone)
00088   {
00089 //  This code works because LEFT is defined as 1, RIGHT as 2, and BOTH as 3.
00090 //  Thus LEFT&LEFT = RIGHT&RIGHT = LEFT&BOTH = RIGHT&BOTH = 1;
00091 //  LEFT&RIGHT = 0.
00092 
00093    if ( top & thisone ) return 2;
00094     return 1;
00095   } 
00096    
00097 };
00098 
00099 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines