cgma
|
00001 //------------------------------------------------------------------------- 00002 // Filename : CompSurfFacets.hpp 00003 // 00004 // Purpose : Encapsulate facet date used to speed up composite surfaces 00005 // 00006 // Special Notes : 00007 // 00008 // Creator : Jason Kraftcheck 00009 // 00010 // Creation Date : 03/20/03 00011 //------------------------------------------------------------------------- 00012 00013 #ifndef COMP_SURF_FACETS_HPP 00014 #define COMP_SURF_FACETS_HPP 00015 00016 #include "CubitVector.hpp" 00017 #include <vector> 00018 #include <map> 00019 #include "DLIList.hpp" 00020 00021 class Surface; 00022 class GMem; 00023 class CubitFacet; 00024 class FacetEvalTool; 00025 00026 00027 template <class X> class DLIList; 00028 00029 class CompSurfFacets 00030 { 00031 typedef std::vector<CubitVector> PointList; 00032 typedef std::vector<int> IntegerList; 00033 typedef std::vector<Surface*> SurfPtrList; 00034 00035 public: 00036 00037 CompSurfFacets(); 00038 ~CompSurfFacets(); 00039 00040 CubitStatus setup( const SurfPtrList& surface_data ); 00041 00042 int closest_index( const CubitVector& from_point, 00043 CubitVector* point_on_facet = 0 ) const; 00044 00045 int closest_index( const CubitVector& from_point, 00046 DLIList<int>& index_list, 00047 CubitVector* point_on_facet = 0 ); 00048 00049 void debug_draw_facets() const; 00050 00051 void graphics( double tolerance, GMem& gmem ); 00052 void set_ignore_flag(DLIList<int> &indicies, int flag); 00053 int get_ignore_flag(int index); 00054 00055 protected: 00056 00057 void closest_tri_point( IntegerList::const_iterator facet, 00058 const CubitVector& from_pt, 00059 CubitVector& result_pt, 00060 bool& interior ) const; 00061 00062 void consolidate_points( double tolerance ); 00063 void consolidate_few_points(double tolerance); 00064 void consolidate_many_points(double tolerance); 00065 00066 private: 00067 00068 bool pointsConsolidated; 00069 IntegerList ignoreFlags; 00070 DLIList<CubitFacet*> facetsToIgnore; 00071 00072 std::map<CubitFacet*, int> facetToSurfaceMap; 00073 DLIList<CubitFacet*> allFacets; 00074 FacetEvalTool *facetEvalTool; 00075 DLIList<int> numFacetsPerSurface; 00076 00077 }; 00078 00079 #endif 00080 00081