include/octree.h
branchpyrit
changeset 98 64638385798a
parent 95 ca7d4c665531
child 103 3b3257a410fe
equal deleted inserted replaced
97:2a853d284a6a 98:64638385798a
    75 {
    75 {
    76 	OctreeNode *root;
    76 	OctreeNode *root;
    77 	const int max_depth;
    77 	const int max_depth;
    78 	bool built;
    78 	bool built;
    79 public:
    79 public:
       
    80 	/** default constructor,
       
    81 	 * maximum depth of tree is set to 10 */
    80 	Octree() : Container(), root(NULL), max_depth(10), built(false) {};
    82 	Octree() : Container(), root(NULL), max_depth(10), built(false) {};
       
    83 
       
    84 	/** constructor
       
    85 	 * @param[in] maxdepth	maximum depth of the tree */
    81 	Octree(int maxdepth) : Container(), root(NULL), max_depth(maxdepth), built(false) {};
    86 	Octree(int maxdepth) : Container(), root(NULL), max_depth(maxdepth), built(false) {};
    82 	~Octree() { if (root) delete root; };
    87 	~Octree() { if (root) delete root; };
    83 	void addShape(const Shape* aShape) { Container::addShape(aShape); built = false; };
    88 	void addShape(const Shape* aShape) { Container::addShape(aShape); built = false; };
    84 	const Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray,
    89 	const Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray,
    85 		Float &nearest_distance);
    90 		Float &nearest_distance);
    86 	void optimize() { build(); };
    91 	void optimize() { build(); };
       
    92 
       
    93 	/** build the octree
       
    94 	 * this is alias of optimize() */
    87 	void build();
    95 	void build();
       
    96 
    88 	void save(ostream &str, OctreeNode *node = NULL) {};
    97 	void save(ostream &str, OctreeNode *node = NULL) {};
    89 	void load(istream &str, OctreeNode *node = NULL) {};
    98 	void load(istream &str, OctreeNode *node = NULL) {};
    90 };
    99 };
    91 
   100 
    92 #endif
   101 #endif