Image Component Library (ICL)
RayCastOctreeObject.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLGeom/src/ICLGeom/RayCastOctreeObject.h **
10 ** Module : ICLGeom **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLGeom/OctreeObject.h>
35 #include <ICLGeom/ViewRay.h>
36 #include <vector>
37 
38 namespace icl{
39  namespace geom {
40 
42 
66  class RayCastOctreeObject : public OctreeObject<float, 16, 1, Vec, 1024>{
68  public:
70  RayCastOctreeObject(const float &minX, const float &minY, const float &minZ,
71  const float &width, const float &height, const float &depth):
72  Super(minX,minY,minZ,width,height,depth){}
73 
75  RayCastOctreeObject(const float &min, const float &len):Super(min,len){}
76 
78 
80 
81 
82  protected:
83 
85  static void ray_cast_sqr_rec(const Super::Node *n, const ViewRay &ray,
86  float maxSqrDist, float maxDist,
87  std::vector<Vec> &result);
88 
89  static void ray_cast_sqr_rec_debug(const RayCastOctreeObject::Super::Node *n, const ViewRay &ray,
90  float maxSqrDist, float maxDist,
91  std::vector<Vec> &result,
92  std::vector<AABB> &boxes, std::vector<Vec> &points);
93  public:
94 
96  ICLGeom_API std::vector<Vec> rayCast(const ViewRay &ray, float maxDist=1) const;
97 
99  ICLGeom_API std::vector<Vec> rayCastDebug(const ViewRay &ray, float maxDist,
100  std::vector<AABB> &boxes, std::vector<Vec> &points) const;
101 
103  ICLGeom_API std::vector<Vec> rayCastSort(const ViewRay &ray, float maxDist = 1) const;
104 
106  ICLGeom_API Vec rayCastClosest(const ViewRay &ray, float maxDist = 1) const ;
107  };
108 
109  }
110 }
undocument this line if you encounter any issues!
Definition: Any.h:37
#define ICLGeom_API
Definition: CompatMacros.h:179
~RayCastOctreeObject()
destructor
Definition: RayCastOctreeObject.h:79
The OctreeObjects provides a visualizable SceneObject interface for the Octree class.
Definition: OctreeObject.h:129
ICLGeom_API Vec rayCastClosest(const ViewRay &ray, float maxDist=1) const
casts a ray and returns the point closest to the ray-offset
ICLGeom_API std::vector< Vec > rayCastSort(const ViewRay &ray, float maxDist=1) const
as ray cast, but sorts the points by distance to the ray-offset
static void ray_cast_sqr_rec(const Super::Node *n, const ViewRay &ray, float maxSqrDist, float maxDist, std::vector< Vec > &result)
internal worker method for recursive ray cast
OctreeObject< float, 16, 1, Vec, 1024 > Super
Definition: RayCastOctreeObject.h:67
RayCastOctreeObject(const float &minX, const float &minY, const float &minZ, const float &width, const float &height, const float &depth)
creates a QuadTree for the given 2D rectangle
Definition: RayCastOctreeObject.h:70
RayCastOctreeObject(const float &min, const float &len)
creates a QuadTree for the given 2D rectangle
Definition: RayCastOctreeObject.h:75
This is a view-ray's line equation in parameter form.
Definition: ViewRay.h:49
static void ray_cast_sqr_rec_debug(const RayCastOctreeObject::Super::Node *n, const ViewRay &ray, float maxSqrDist, float maxDist, std::vector< Vec > &result, std::vector< AABB > &boxes, std::vector< Vec > &points)
depth
determines the pixel type of an image (8Bit-int or 32Bit-float)
Definition: Types.h:60
Special Octree implemenation that supports to query points close to caste rays.
Definition: RayCastOctreeObject.h:66
ICLGeom_API std::vector< Vec > rayCastDebug(const ViewRay &ray, float maxDist, std::vector< AABB > &boxes, std::vector< Vec > &points) const
casts a ray and returns all points that are closer than given distance to ray
ICLGeom_API std::vector< Vec > rayCast(const ViewRay &ray, float maxDist=1) const
casts a ray and returns all points that are closer than given distance to ray