GEL
2
GEL is a library for Geometry and Linear Algebra
|
00001 #ifndef __GEOMETRY_BOUNDINGTREE_H 00002 #define __GEOMETRY_BOUNDINGTREE_H 00003 00004 #include "BoundingNode.h" 00005 #include "BoundingLNode.h" 00006 #include "BoundingINode.h" 00007 #include "Ray.h" 00008 00009 namespace Geometry 00010 { 00011 00012 template<class BoxType> 00013 class BoundingTree 00014 { 00015 public: 00016 00017 typedef BoundingNode<BoxType> Node; 00018 typedef BoundingLNode<BoxType> LeafNode; 00019 typedef BoundingINode<BoxType> IntNode; 00020 00021 Node* root; 00022 00023 public: 00024 00025 BoundingTree(): root(0) {} 00026 00027 ~BoundingTree() {delete root;} 00028 00029 void build(std::vector<Triangle>& triangles); 00030 00031 bool intersect(const CGLA::Vec3f&,const CGLA::Vec3f&,float&) const; 00032 00033 void intersect(Ray& r) const; 00034 00035 int intersect_cnt(const CGLA::Vec3f&,const CGLA::Vec3f&) const; 00036 00037 float compute_signed_distance(const CGLA::Vec3f& p, float=FLT_MAX) const; 00038 }; 00039 00040 } 00041 00042 #endif