Helios++
Helios software for LiDAR simulations
KDTreeRaycaster Class Reference

Class representing a KDTree ray caster. More...

#include <KDTreeRaycaster.h>

Public Member Functions

 KDTreeRaycaster (std::shared_ptr< KDTreeNode > root)
 KDTree ray caster constructor. More...
 
std::map< double, Primitive * > searchAll (glm::dvec3 _rayOrigin, glm::dvec3 _rayDir, double tmin, double tmax, bool groundOnly)
 Search all intersections for specified ray. More...
 
RaySceneIntersectionsearch (glm::dvec3 _rayOrigin, glm::dvec3 _rayDir, double tmin, double tmax, bool groundOnly)
 Search first intersection for specified ray. More...
 
void searchAll_recursive (KDTreeNode *node, double tmin, double tmax)
 Recursive search function to assist searchAll function. More...
 
Primitivesearch_recursive (KDTreeNode *node, double tmin, double tmax)
 Recursive search function to assist search function. More...
 

Public Attributes

double epsilon = 0.0001
 Decimal precision for the ray caster.
 
bool groundOnly = false
 Flag to specify if only ground points must be considered (true) or not (false)
 
glm::dvec3 rayDir
 Ray 3D director vector.
 
glm::dvec3 rayOrigin
 Ray origin 3D coordinates.
 
std::vector< double > rayDirArray
 Vector containing components of ray director vector. It is filled at the start of a search operation. More...
 
std::vector< double > rayOriginArray
 Vector containing components of ray origin. It is filled at the start of a search operation. More...
 
std::shared_ptr< KDTreeNoderoot
 Shared pointer to the root node of the KDTree.
 
double closestHitDistance = std::numeric_limits<double>::max()
 Distance of closest hit. It is numeric_limits<double>::max() by default.
 
std::map< double, Primitive * > collectedPoints
 Map of primitives identified by its distance with respect to ray origin. Only primitives which intersect with the ray are considered (i.e. those which distance with respect to ray origin is greater than 0)
 

Detailed Description

Class representing a KDTree ray caster.

Constructor & Destructor Documentation

◆ KDTreeRaycaster()

KDTreeRaycaster::KDTreeRaycaster ( std::shared_ptr< KDTreeNode root)
inline

KDTree ray caster constructor.

Parameters
rootRoot node of the KDTree

Member Function Documentation

◆ search()

RaySceneIntersection * KDTreeRaycaster::search ( glm::dvec3  _rayOrigin,
glm::dvec3  _rayDir,
double  tmin,
double  tmax,
bool  groundOnly 
)

Search first intersection for specified ray.

Parameters
_rayOriginRay origin 3D coordinates
_rayDirRay 3D director vector
tminMinimum time to intersection. It is used to prevent considering intersections (capturing points) before this time during the recursive search process
tmaxMaximum time to intersection. It is used to prevent considering intersections (capturing points) after this time during the recursive search process
groundOnlyFlag to specify if only ground primitives must be considered (true) or not (false)
Returns
Return first found intersection
See also
KDTreeRaycaster::search_recursive

◆ search_recursive()

Primitive * KDTreeRaycaster::search_recursive ( KDTreeNode node,
double  tmin,
double  tmax 
)

Recursive search function to assist search function.

Parameters
nodeKDTree node to be recursively explored
tminMinimum time to intersection. It is used to prevent considering intersections (capturing points) before this time during the recursive search process
tmaxMaximum time to intersection. It is used to prevent considering intersections (capturing points) after this time during the recursive search process
Returns
Return first found intersection
See also
KDTreeRaycaster::search

◆ searchAll()

map< double, Primitive * > KDTreeRaycaster::searchAll ( glm::dvec3  _rayOrigin,
glm::dvec3  _rayDir,
double  tmin,
double  tmax,
bool  groundOnly 
)

Search all intersections for specified ray.

Parameters
_rayOriginRay origin 3D coordinates
_rayDirRay 3D director vector
tminMinimum time to intersection. It is used to prevent considering intersections (capturing points) before this time during the recursive search process
tmaxMaximum time to intersection. It is used to prevent considering intersections (capturing points) after this time during the recursive search process
groundOnlyFlag to specify if only ground primitives must be considered (true) or not (false)
Returns
Return map of collected primitives, each identified by its distance with respect to ray origin
See also
KDTreeRaycaster::searchAll_recursive

◆ searchAll_recursive()

void KDTreeRaycaster::searchAll_recursive ( KDTreeNode node,
double  tmin,
double  tmax 
)

Recursive search function to assist searchAll function.

Parameters
nodeKDTree node to be recursively explored
tminMinimum time to intersection. It is used to prevent considering intersections (capturing points) before this time during the recursive search process
tmaxMaximum time to intersection. It is used to prevent considering intersections (capturing points) after this time during the recursive search process
See also
KDTreeRaycaster::searchAll

Member Data Documentation

◆ rayDirArray

std::vector<double> KDTreeRaycaster::rayDirArray

Vector containing components of ray director vector. It is filled at the start of a search operation.

See also
KDTreeRaycaster::searchAll
KDTreeRaycaster::search

◆ rayOriginArray

std::vector<double> KDTreeRaycaster::rayOriginArray

Vector containing components of ray origin. It is filled at the start of a search operation.

See also
KDTreeRaycaster::searchAll
KDTreeRaycaster::search

The documentation for this class was generated from the following files: