00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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;
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