00001 00002 //*************************************************************************** 00003 // ColConvexHull 00004 //*************************************************************************** 00005 // Copyright (C): 00006 //*************************************************************************** 00007 //CVSId: "@(#)$Id: ColConvexHull.h,v 1.3 2004/02/26 14:50:15 ehlgen Exp $" 00008 //*************************************************************************** 00009 00010 00011 #ifndef ColConvexHull_H 00012 #define ColConvexHull_H 00013 #if defined(__sgi) || defined(_WIN32) 00014 #pragma once 00015 #endif 00016 00017 //--------------------------------------------------------------------------- 00018 // Includes 00019 //--------------------------------------------------------------------------- 00020 00021 #include <OpenSG/OSGGeometry.h> 00022 #include <OpenSG/OSGVector.h> 00023 00024 #include <ColTopology.h> 00025 #include <ColVisDebug.h> 00026 00027 #include <col_import_export.h> 00028 00029 00030 namespace col { 00031 00032 00033 //--------------------------------------------------------------------------- 00034 // Forward References 00035 //--------------------------------------------------------------------------- 00036 00037 struct SepPlane; 00038 00039 //--------------------------------------------------------------------------- 00040 // Constants 00041 //--------------------------------------------------------------------------- 00042 00046 const float M_InitEta = 0.1; 00047 const float M_MaxSteps = 150; 00048 const float M_AnnealingFactor = 0.97; 00049 00050 00051 //*************************************************************************** 00052 // ColConvexHull 00053 //*************************************************************************** 00054 00055 00056 class COL_EXPORTIMPORT ConvexHull 00057 { 00058 00059 00060 //--------------------------------------------------------------------------- 00061 // Public Instance methods 00062 //--------------------------------------------------------------------------- 00063 00064 public: 00065 00066 ConvexHull( ); 00067 explicit ConvexHull( const ConvexHull & source ); 00068 void operator = ( const ConvexHull & source ); 00069 00070 ConvexHull( const osg::GeometryPtr geom ); 00071 void operator = ( const osg::GeometryPtr geom ); 00072 00073 bool check( const ConvexHull &other, const osg::Matrix m12, 00074 SepPlane *plane, VisDebug *visdebug = NULL ) const; 00075 00076 osg::NodePtr getGeomNode( void ); 00077 void print( void ); 00078 00079 virtual ~ConvexHull() throw(); 00080 00081 //--------------------------------------------------------------------------- 00082 // Instance variables 00083 //--------------------------------------------------------------------------- 00084 00085 protected: 00086 00088 vector<osg::Pnt3f> m_vertex; 00089 00091 vector<TopoFace> m_face; 00092 00094 osg::GeometryPtr m_org_geom; // TODO GeometryConstPtr, wenn OSG soweit 00095 00097 osg::NodePtr m_hull_node; 00098 00102 Topology m_topo; 00103 00104 //--------------------------------------------------------------------------- 00105 // Class variables 00106 //--------------------------------------------------------------------------- 00107 00108 //--------------------------------------------------------------------------- 00109 // Private Instance methods 00110 //--------------------------------------------------------------------------- 00111 00112 protected: 00113 00114 void createHull( void ); 00115 00116 }; 00117 00118 00119 00120 //*************************************************************************** 00121 // SepPlane 00122 //*************************************************************************** 00123 00124 00125 struct COL_EXPORTIMPORT SepPlane 00126 { 00127 SepPlane(); 00128 00129 osg::Vec4f m_w; 00130 unsigned int m_closest_p1, m_closest_p2; 00131 00132 }; 00133 00134 00135 00136 } // namespace col 00137 00138 #endif /* ConvexHull_H */ 00139