box_system.h
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 #ifndef BOX_SYSTEM_HEADER
00029 #define BOX_SYSTEM_HEADER
00030
00031
00032 #include "realtype.h"
00033
00034
00035 typedef struct
00036 {
00037 ergo_real centerCoords[3];
00038 int originalIndex;
00039 } box_item_struct;
00040
00041
00042 typedef struct
00043 {
00044 ergo_real centerCoords[3];
00045 ergo_real width;
00046 int noOfItems;
00047 int firstItemIndex;
00048 int noOfChildBoxes;
00049 int firstChildBoxIndex;
00050 } box_struct_basic;
00051
00052 typedef struct
00053 {
00054 int noOfBoxes;
00055 int startIndexInBoxList;
00056 } box_level_struct;
00057
00058 #define MAX_NO_OF_BOX_LEVELS 20
00059
00060 class BoxSystem
00061 {
00062 public:
00063 int totNoOfBoxes;
00064 int noOfLevels;
00065 box_level_struct levelList[MAX_NO_OF_BOX_LEVELS];
00066 box_struct_basic* boxList;
00067 BoxSystem();
00068 ~BoxSystem();
00069 int create_box_system(box_item_struct* itemList,
00070 int noOfItems,
00071 ergo_real toplevelBoxSize);
00072 int get_items_near_point(const box_item_struct* itemList,
00073 const ergo_real* coords,
00074 ergo_real distance,
00075 int* resultOrgIndexList) const;
00076 private:
00077 int get_items_near_point_recursive(const box_item_struct* itemList,
00078 const ergo_real* coords,
00079 ergo_real distance,
00080 int* resultOrgIndexList,
00081 int level,
00082 int boxIndex) const;
00083 };
00084
00085
00086
00087
00088 #endif