Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

poledges.h

00001 /*
00002     Copyright (C) 2000 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef _CS_POLEDGES_H
00020 #define _CS_POLEDGES_H
00021 
00022 #include "csutil/hashmap.h"
00023 
00024 class csPolygonInt;
00025 class csPolygon3D;
00026 class csPolygonEdges;
00027 
00031 struct csPolEdge
00032 {
00033   csPolygon3D* p;
00034   int i1, i2;   // Edge; i1 < i2
00035 };
00036 
00041 class csPolEdgeIterator
00042 {
00043   friend class csPolygonEdges;
00044 
00045 private:
00047   csHashIterator* iterator;
00049   int i1, i2;
00051   csPolEdge* current;
00052 
00053 private:
00058   csPolEdgeIterator (csHashMap& edges, int i1, int i2);
00059 
00060 public:
00062   virtual ~csPolEdgeIterator ();
00063 
00065   bool HasNext ()
00066   {
00067     return current != NULL;
00068   }
00069 
00071   csPolygon3D* Next ();
00072 };
00073 
00077 class csEdgeIterator
00078 {
00079   friend class csPolygonEdges;
00080 
00081 private:
00083   csHashIterator* iterator;
00085   csPolEdge* current;
00086 
00087 private:
00092   csEdgeIterator (csHashMap& edges);
00093 
00094 public:
00096   virtual ~csEdgeIterator ();
00097 
00099   bool HasNext ()
00100   {
00101     return current != NULL;
00102   }
00103 
00105   csPolygon3D* Next (int& e1, int& e2);
00106 };
00107 
00111 class csPolygonEdges
00112 {
00113 private:
00120   csHashMap edges;
00121 
00122 public:
00128   csPolygonEdges (csPolygonInt** polygons, int num_polygons);
00129 
00133   virtual ~csPolygonEdges ();
00134 
00141   csPolEdgeIterator* GetPolygons (int i1, int i2)
00142   {
00143     return new csPolEdgeIterator (edges, i1, i2);
00144   }
00145 
00150   csEdgeIterator* GetEdges ()
00151   {
00152     return new csEdgeIterator (edges);
00153   }
00154 };
00155 
00156 #endif // __CS_POLEDGES_H__
00157 

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000