QuonPDefs.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
00003 //
00004 // This program is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU General Public License
00006 // as published by the Free Software Foundation; either version 2
00007 // of the License, or (at your option) any later version.
00008 //
00009 // This program 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
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 //
00018 
00024 #ifndef __QUONPDEFS_H_
00025 #define __QUONPDEFS_H_
00026 
00027 #include <map>
00028 #include <QuonDefs.h>
00029 
00031 
00032 class QPBoundingBox
00033 {
00034     public:
00035         QPBoundingBox();
00036         QPBoundingBox(Vector2D tl, Vector2D br);
00037         QPBoundingBox(double tlx, double tly, double brx, double bry);
00038         QPBoundingBox(Vector2D center, double width);
00039         void resize(double width);
00040         bool collide(const Vector2D p) const;
00041         Vector2D tl, br; //top left, bottom right
00042         friend std::ostream& operator<<(std::ostream& Stream, const QPBoundingBox& box);
00043 };
00044 
00045 class QPCircle
00046 {
00047     public:
00048         QPCircle();
00049         QPCircle(Vector2D center, double diameter);
00050         void resize(double diameter);
00051         bool collide(const Vector2D p) const;
00052         Vector2D center;
00053         double radius;
00054         friend std::ostream& operator<<(std::ostream& Stream, const QPCircle& circle);
00055 };
00056 
00057 class QPSite
00058 {
00059     public:
00060         QPSite();
00061         Vector2D position;
00062         QNeighborType type;
00063         NodeHandle address;
00064         double AOIwidth;
00065         bool dirty;
00066         bool alive;
00067         friend std::ostream& operator<<(std::ostream& Stream, const QPSite& s);
00068 };
00069 
00070 class PTreeNode
00071 {
00072     public:
00073         PTreeNode(PTreeNode* parent);
00074         QPSite* contents;
00075         PTreeNode* parent;
00076         PTreeNode* child[4];
00077         void add(QPSite* site);
00078         void reset();
00079         QPSite* findNearestNeighbor(const Vector2D p) const;
00080     private:
00081         int getQuadrant(const Vector2D p) const;
00082 };
00083 
00084 typedef std::map<OverlayKey, QPSite*> PSiteMap;
00085 
00086 #endif

Generated on Wed Mar 25 16:32:49 2009 for OverSim by  doxygen 1.5.5