Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #pragma once
00029 #ifndef OBJTREE_OCTREE_H
00030 #define OBJTREE_OCTREE_H
00031
00032 #include <map>
00033 #include <list>
00034 #include <set>
00035 #include <srs_env_model/but_server/objtree/box.h>
00036
00037 namespace objtree
00038 {
00039
00040 class Node;
00041 class Object;
00042 class Filter;
00043
00048 class Octree
00049 {
00050 public:
00051 static const unsigned int DEFAULT_MAX_DEPTH = 4;
00052
00053 private:
00054 Node *m_root;
00055 Box m_rootSize;
00056 unsigned int m_maxId;
00057 unsigned int m_maxDepth;
00058 std::map<unsigned int, Object*> m_objects;
00059
00060 public:
00061 Octree(unsigned int maxDepth = DEFAULT_MAX_DEPTH);
00062 Octree(const Box &rootSize, unsigned int maxDepth = DEFAULT_MAX_DEPTH);
00063 ~Octree();
00064
00065 void clear();
00066
00067 unsigned int insert(Object* object);
00068 unsigned int insertOnFit(Object* object);
00069 unsigned int insertOnInterfere(Object* object, Node *node, Box box, unsigned int depth = 0);
00070
00071 unsigned int insertUpdate(Object* object);
00072 unsigned int insertUpdate2(Object* object);
00073 unsigned int insertUpdateOnInterfere(Object* object, Node *node, Box box, bool &inserted, unsigned int depth = 0);
00074
00075 Object* getSimilarObject(const Object *object);
00076 Object* getSimilarObject(const Object *object, Node *node, Box box, unsigned int depth = 0);
00077 bool isPositionFree(float x, float y, float z);
00078
00079 Node* root() const;
00080 unsigned int maxId() const;
00081 unsigned int count() const;
00082
00083 const Object* object(unsigned int id) const;
00084 bool removeObject(unsigned int id);
00085
00086 void nodes(std::list<Box> &nodesList, std::set<Object*> &objectList, const Filter *filter);
00087 void nodes(std::list<Box> &nodesList, std::set<Object*> &objectList, const Filter *filter, Box dim, Node *node);
00088 void objects(std::set<Object*> &objectList, const Filter *filter);
00089
00090 const std::map<unsigned int, Object*>& objectsAll() const;
00091 };
00092
00093 }
00094
00095 #endif // OBJTREE_OCTREE_H
srs_env_model
Author(s): Vit Stancl (stancl@fit.vutbr.cz), Tomas Lokaj, Jan Gorig, Michal Spanel (spanel@fit.vutbr.cz)
autogenerated on Mon Oct 6 2014 08:05:05