collisiondetectors/CD_rangesensor/octree.h

Go to the documentation of this file.
00001 #if !defined(octree_h__INCLUDED_)
00002 #define octree_h__INCLUDED_
00003 
00004 #include "geometry\geo_rangesensor\Range_Sensor.h"
00005 #include <stdio.h>
00006 #include <stdlib.h>
00007 #include <math.h>
00008 #include <string.h>
00009 
00010 #include <set>
00011 #include <algorithm>
00012 #include <iterator>
00013 #include <functional>
00014 
00015 //using namespace std ;
00016 //#define SPAN_ANGLE 30
00017 //#define SIZE_OF_CONE 0.1
00018 #define TRUE 1
00019 #define FALSE 0
00020 #define WHITE 0
00021 #define BLACK 3
00022 #define GRAY 1
00023 
00024 //resolution notes:
00025 //worldsize = 256/(2^7) = 2 units minimum l,w,h; # levels = 7+1 = 8
00026 #define LIMIT 128
00027 #define LIMITP 127
00028 #define TEMP_EPSILON 0.00000001
00029 #define DBL_LIMIT (128+TEMP_EPSILON)
00030 #define DBL_LIMITP (127+TEMP_EPSILON)
00031 
00032 
00033 #define INSIDE 0
00034 #define OUTSIDE 1
00035 
00036 #define MAXLINELENGTH 444
00037 #define MAXBUFFSIZE (64*64)
00038 #define NUMELEMENTS (256*256)
00039 
00040 
00041 class PointClass
00042 {
00043 public:
00044   char p[3];
00045 };
00046 
00047 #define PointsList std::set<PointClass>;
00048 
00049 struct vector_d {
00050         double x, y ,z;
00051 };
00052 
00053 struct vector_i {
00054         int x, y, z;
00055 };
00056 
00057 
00058 struct free_space {
00059         struct vector_d apex; // apex of the V-cone, where the sensor is
00060   //struct vector_d heading; // sensor direction
00061   //struct vector_d position[256][256]; // the data from your sensor
00062         short scaled_distance[6][256][256]; // internal use, don't fill
00063         struct vector_d bound_start, bound_end; // internal use, don't fill
00064 };
00065 
00066 struct OctreeNode;
00067 
00068 struct child_pointer
00069 {
00070         OctreeNode* pointer[8];
00071 };
00072 
00073 struct OctreeNode 
00074 {
00075         struct child_pointer *son;
00076         OctreeNode* father;
00077         char color;
00078         //double info_value;
00079 };
00080 
00081 struct cubic {
00082         int x0, y0, z0;
00083         int x1, y1, z1;
00084 };
00085 
00086 struct cubic_d {
00087         double x0, y0, z0;
00088         double x1, y1, z1;
00089 };
00091 // Octree Contruction Components
00093 
00094 
00095 void mapping(struct free_space *a, 
00096              vector_d *point, 
00097              int proj_point[3]);
00098 OctreeNode *construct_octree(struct free_space *a, 
00099                                                  struct cubic *scope, 
00100                                                  int level, int maxlevel);
00101 OctreeNode * assign_white_node();
00102 OctreeNode * assign_black_node();
00103 OctreeNode * assign_gray_node(struct free_space *a, 
00104                                                  struct cubic *c, int level,int maxlevel);
00105 inline void scale_distance_assign(int [3], int, int, 
00106              struct free_space *, Range_Sensor* jc);
00107 void calculate_scaled_distance(struct free_space *a, Range_Sensor* jc);
00108 
00109 
00110 #endif

Generated on Sat Apr 1 21:30:37 2006 for Motion Planning Kernel by  doxygen 1.4.6-NO