planners/obsolete/PL_SimplexSubdivision.h

Go to the documentation of this file.
00001 //## begin module%39864C6600AA.cm preserve=no
00002 //        %X% %Q% %Z% %W%
00003 //## end module%39864C6600AA.cm
00004 
00005 //## begin module%39864C6600AA.cp preserve=no
00006 //## end module%39864C6600AA.cp
00007 
00008 //## Module: PL_SimplexSubdivision%39864C6600AA; Pseudo Package specification
00009 //## Source file: C:\project\mpk\code\Planners\PL_SimplexSubdivision.h
00010 
00011 #ifndef PL_SimplexSubdivision_h
00012 #define PL_SimplexSubdivision_h 1
00013 
00014 //## begin module%39864C6600AA.additionalIncludes preserve=no
00015 //## end module%39864C6600AA.additionalIncludes
00016 
00017 //## begin module%39864C6600AA.includes preserve=yes
00018 //## end module%39864C6600AA.includes
00019 
00020 #include "Planners\PL_OpenGL.h"
00021 #include "Planners\obsolete\PL_LinearCollision.h"
00022 #include <set>
00023 
00024 //## begin PL_SimplexSubdivision%39864C6600AA.preface preserve=yes
00025 #pragma warning( disable : 4250 )
00026 #pragma warning( disable : 4786 )
00027 //## end PL_SimplexSubdivision%39864C6600AA.preface
00028 
00029 //## Class: PL_SimplexSubdivision%39864C6600AA
00030 //## Category: Planners%36FB140B003C
00031 //## Persistence: Transient
00032 //## Cardinality/Multiplicity: n
00033 //=============================================================================
00034 class PL_SimplexSubdivision 
00035 : 
00036         public PL_LinearCollision, //## Inherits: <unnamed>%39864C740230
00037     public PL_OpenGL  //## Inherits: <unnamed>%39864C77032A
00038 {
00039   //## begin PL_SimplexSubdivision%39864C6600AA.initialDeclarations preserve=yes
00040 public:
00041         //=========================================================================
00042         enum CollisionType
00043         {
00044                 CT_FREE,
00045                 CT_COLLISION,
00046                 CT_MIXED,
00047                 CT_UNKNOWN
00048         };
00049         //=========================================================================
00050 protected:
00051         //=========================================================================
00052         struct Node
00053         {
00054                 //adds an adjacent node
00055                 void AddNeighbor( const int node );
00056 
00057                 //gets the center of the node
00058                 Configuration Center() const;
00059 
00060                 //is this configuration in this node?
00061                 bool Contains( const Configuration& c ) const;
00062 
00063                 //is this configuration in this node?
00064                 bool ContainsCompletely( const Configuration& c ) const;
00065 
00066                 //draws the node
00067                 void DrawExplicit() const;
00068 
00069                 //sets the color of this node
00070                 void GlColor() const;
00071 
00072                 //determines if the node is free of any colliding neighbors
00073                 bool IsClean() const;
00074 
00075                 //removes a neighbor
00076                 void RemoveNeighbor( const int node );
00077 
00078                 //returns the size of the node
00079                 double Volume() const;
00080 
00081                 bool m_Alive;
00082                 double m_DistanceFromStart;
00083                 Configuration m_Min;
00084                 Configuration m_Max;
00085                 std::vector< int > m_NodesAdjacent;
00086                 std::vector< CollisionType > m_LinkType;
00087                 Configuration m_LocationOfCollision;
00088         };
00089         //=========================================================================
00090 
00091   //## end PL_SimplexSubdivision%39864C6600AA.initialDeclarations
00092 
00093   public:
00094           //constructor
00095       PL_SimplexSubdivision();
00096 
00097       //destructor
00098       virtual ~PL_SimplexSubdivision();
00099 
00100       virtual bool DrawExplicit () const;
00101 
00102       virtual bool Plan ();
00103 
00104           //returns the volume of a node
00105           double Volume( const int i ) const;
00106 
00107 
00108   protected:
00109 
00110     //## Other Operations (specified)
00111       //## Operation: AddEdge%965103447
00112       void AddEdge( const int node0, const int node1 );
00113 
00114       //## Operation: AddNode%965103446
00115       int AddNode ( const Configuration& min, const Configuration& max );
00116 
00117           //adds a suspicious node to the set
00118           void AddSuspiciousNode( const int nodeNum );
00119 
00120           //adds a node to the open list - if it's not in the closed list already
00121           void AddToOpenList( const int nodeNum );
00122 
00123           //checks two nodes for collisions between them
00124           CollisionType CollisionCheck( const int n0, const int n1 );
00125 
00126           //deletes an already existing node
00127           void DeleteEdge( const int node0, const int node1 );
00128 
00129           //deletes an already existing node
00130           void DeleteNode( const int nodeNum );
00131 
00132           //connects the start and the goal to the tree
00133           void ConnectStartAndGoal();
00134 
00135           //test if two nodes are adjacent 
00136           bool IsAdjacent( int node0, int node1 );
00137 
00138           //searches for the goal until no nodes remain on the open list
00139           bool SearchForGoal();
00140 
00141           //subdivides the largest node on the list of suspicious nodes
00142           void SubdivideLargestNode();
00143 
00144       //## Operation: SubdivideSimplex%965161039
00145       void SubdivideNode( int nodeNum );
00146 
00147           //this is the vector of nodes
00148           std::vector< Node > m_Nodes;
00149 
00150           //these are the numbers for the start and goal nodes
00151           int m_NodeStart;
00152           int m_NodeGoal;
00153 
00154           std::set< int > m_OpenList;
00155           std::set< int > m_ClosedList;
00156           struct ComparisonFunction
00157           {
00158           public:
00159                   ComparisonFunction( const PL_SimplexSubdivision* planner );
00160                   ComparisonFunction( const ComparisonFunction& right );
00161                   bool operator()( const int a, const int b );
00162                   const PL_SimplexSubdivision* m_Planner;
00163           };
00164           ComparisonFunction m_Compare;
00165           typedef std::set< int, ComparisonFunction > INTSET;
00166           INTSET m_SuspiciousNodesAndVolumes;
00167 
00168       //## end PL_SimplexSubdivision%39864C6600AA.protected
00169   private:
00170     // Additional Private Declarations
00171       //## begin PL_SimplexSubdivision%39864C6600AA.private preserve=yes
00172       //## end PL_SimplexSubdivision%39864C6600AA.private
00173 
00174   private: //## implementation
00175     // Additional Implementation Declarations
00176       //## begin PL_SimplexSubdivision%39864C6600AA.implementation preserve=yes
00177       //## end PL_SimplexSubdivision%39864C6600AA.implementation
00178 
00179 };
00180 
00181 //## begin PL_SimplexSubdivision%39864C6600AA.postscript preserve=yes
00182 //## end PL_SimplexSubdivision%39864C6600AA.postscript
00183 
00184 // Class PL_SimplexSubdivision 
00185 
00186 //## begin module%39864C6600AA.epilog preserve=yes
00187 //## end module%39864C6600AA.epilog
00188 
00189 
00190 #endif

Generated on Sat Apr 1 21:30:44 2006 for Motion Planning Kernel by  doxygen 1.4.6-NO