Developer Documentation
BSPImplT< BSPCore > Class Template Reference
Inheritance diagram for BSPImplT< BSPCore >:

Classes

struct  less_pair_second
 
struct  NearestNeighbor
 Store nearest neighbor information. More...
 
struct  NearestNeighborData
 Store nearest neighbor information. More...
 
struct  RayCollisionData
 Store ray collide information. More...
 

Public Types

typedef BSPCore::Traits Traits
 
typedef BSPCore::Handle Handle
 
typedef BSPCore::Point Point
 
typedef BSPCore::Scalar Scalar
 
typedef BSPCore::Node Node
 
typedef BSPCore::Handles Handles
 
typedef BSPCore::HandleIter HandleIter
 
typedef std::vector< std::pair< Handle, Scalar > > RayCollision
 Store nearest neighbor information. More...
 

Public Member Functions

 BSPImplT (const Traits &_traits, const Scalar &_infinity=std::numeric_limits< Scalar >::infinity())
 
NearestNeighbor nearest (const Point &_p) const
 Return handle of the nearest neighbor face. More...
 
RayCollision raycollision (const Point &_p, const Point &_r) const
 intersect mesh with ray More...
 
RayCollision directionalRaycollision (const Point &_p, const Point &_r) const
 intersect mesh with ray More...
 
RayCollision nearestRaycollision (const Point &_p, const Point &_r) const
 intersect mesh with ray More...
 
template<class Callback >
void intersectBall (const Point &_c, Scalar _r, Callback _callback) const
 intersect mesh with open ball More...
 

Private Member Functions

void _nearest (Node *_node, NearestNeighborData &_data) const
 
void _raycollision_non_directional (Node *_node, RayCollisionData &_data) const
 recursive part of raycollision() More...
 
void _raycollision_directional (Node *_node, RayCollisionData &_data) const
 recursive part of directionalRaycollision() More...
 
void _raycollision_nearest_directional (Node *_node, RayCollisionData &_data) const
 
template<class Callback >
void _intersect_ball (const Node &_node, const Point &_c, Scalar _r, Callback _callback) const
 

Private Attributes

const Scalar infinity_
 

Detailed Description

template<class BSPCore>
class BSPImplT< BSPCore >

Definition at line 64 of file BSPImplT.hh.

Member Typedef Documentation

◆ Handle

template<class BSPCore >
typedef BSPCore::Handle BSPImplT< BSPCore >::Handle

Definition at line 69 of file BSPImplT.hh.

◆ HandleIter

template<class BSPCore >
typedef BSPCore::HandleIter BSPImplT< BSPCore >::HandleIter

Definition at line 74 of file BSPImplT.hh.

◆ Handles

template<class BSPCore >
typedef BSPCore::Handles BSPImplT< BSPCore >::Handles

Definition at line 73 of file BSPImplT.hh.

◆ Node

template<class BSPCore >
typedef BSPCore::Node BSPImplT< BSPCore >::Node

Definition at line 72 of file BSPImplT.hh.

◆ Point

template<class BSPCore >
typedef BSPCore::Point BSPImplT< BSPCore >::Point

Definition at line 70 of file BSPImplT.hh.

◆ RayCollision

template<class BSPCore >
typedef std::vector< std::pair<Handle,Scalar> > BSPImplT< BSPCore >::RayCollision

Store nearest neighbor information.

Definition at line 95 of file BSPImplT.hh.

◆ Scalar

template<class BSPCore >
typedef BSPCore::Scalar BSPImplT< BSPCore >::Scalar

Definition at line 71 of file BSPImplT.hh.

◆ Traits

template<class BSPCore >
typedef BSPCore::Traits BSPImplT< BSPCore >::Traits

Definition at line 68 of file BSPImplT.hh.

Constructor & Destructor Documentation

◆ BSPImplT()

template<class BSPCore >
BSPImplT< BSPCore >::BSPImplT ( const Traits &  _traits,
const Scalar &  _infinity = std::numeric_limits<Scalar>::infinity() 
)
inline

Definition at line 79 of file BSPImplT.hh.

◆ ~BSPImplT()

template<class BSPCore >
BSPImplT< BSPCore >::~BSPImplT ( )
inline

Definition at line 82 of file BSPImplT.hh.

Member Function Documentation

◆ _intersect_ball()

template<class BSPCore >
template<class Callback >
void BSPImplT< BSPCore >::_intersect_ball ( const Node &  _node,
const Point &  _c,
Scalar  _r,
Callback  _callback 
) const
private

Definition at line 318 of file BSPImplT_impl.hh.

◆ _nearest()

template<class BSPCore >
void BSPImplT< BSPCore >::_nearest ( Node *  _node,
NearestNeighborData _data 
) const
private

Definition at line 85 of file BSPImplT_impl.hh.

◆ _raycollision_directional()

template<class BSPCore >
void BSPImplT< BSPCore >::_raycollision_directional ( Node *  _node,
RayCollisionData _data 
) const
private

recursive part of directionalRaycollision()

Parameters
_nodeThe current node in the tree
_dataData pointer, used to collect the collision information

Definition at line 228 of file BSPImplT_impl.hh.

◆ _raycollision_nearest_directional()

template<class BSPCore >
void BSPImplT< BSPCore >::_raycollision_nearest_directional ( Node *  _node,
RayCollisionData _data 
) const
private

Definition at line 267 of file BSPImplT_impl.hh.

◆ _raycollision_non_directional()

template<class BSPCore >
void BSPImplT< BSPCore >::_raycollision_non_directional ( Node *  _node,
RayCollisionData _data 
) const
private

recursive part of raycollision()

Parameters
_nodeThe current node in the tree
_dataData pointer, used to collect the collision information

Definition at line 190 of file BSPImplT_impl.hh.

◆ directionalRaycollision()

template<class BSPCore >
BSPImplT< BSPCore >::RayCollision BSPImplT< BSPCore >::directionalRaycollision ( const Point &  _p,
const Point &  _r 
) const

intersect mesh with ray

This function shots a ray through the mesh and collects all intersected triangles and the handle of the closest face ( directional, so the ray direction is taken into account!).

Only hits with a distance > 0.0 to the point p will be collected (_p will be skipped!)

Parameters
_pStart point of the ray
_rRay direction
Returns
Collision information

Definition at line 143 of file BSPImplT_impl.hh.

◆ intersectBall()

template<class BSPCore >
template<class Callback >
void BSPImplT< BSPCore >::intersectBall ( const Point &  _c,
Scalar  _r,
Callback  _callback 
) const

intersect mesh with open ball

All triangles that have at least one vertex (!) inside the ball are given to the Callback, triangles which have no vertex inside the ball but intersect it MAY be returned. (TODO) Each triangle can be returned up to three times, make sure to handle this, e.g. by putting the values into an std::(unordered_)set.

Parameters
_cCenter of the ball
_rRadius of the ball
_callbackCallable that accepts Handle or const Handle&, e.g. (const Handle &h) -> void

Definition at line 178 of file BSPImplT_impl.hh.

◆ nearest()

template<class BSPCore >
BSPImplT< BSPCore >::NearestNeighbor BSPImplT< BSPCore >::nearest ( const Point &  _p) const

Return handle of the nearest neighbor face.

Definition at line 67 of file BSPImplT_impl.hh.

◆ nearestRaycollision()

template<class BSPCore >
BSPImplT< BSPCore >::RayCollision BSPImplT< BSPCore >::nearestRaycollision ( const Point &  _p,
const Point &  _r 
) const

intersect mesh with ray

This function shots a ray through the mesh and determines the first intersected triangle and the handle of the closest face ( directional, so the ray direction is taken into account!).

Only hits with a distance > 0.0 to the point p will be collected (_p will be skipped!). Note that for compatibility reasons the return type is still a vector of collisions.

Parameters
_pStart point of the ray
_rRay direction
Returns
Collision information

Definition at line 161 of file BSPImplT_impl.hh.

◆ raycollision()

template<class BSPCore >
BSPImplT< BSPCore >::RayCollision BSPImplT< BSPCore >::raycollision ( const Point &  _p,
const Point &  _r 
) const

intersect mesh with ray

This function shots a ray through the mesh and collects all intersected triangles and the handle of the closest face ( non-directional, so no matter of the ray direction, the closest face handle is returned in either direction)

Parameters
_pStart point of the ray
_rRay direction
Returns
Collision information

Definition at line 126 of file BSPImplT_impl.hh.

Member Data Documentation

◆ infinity_

template<class BSPCore >
const Scalar BSPImplT< BSPCore >::infinity_
private

Definition at line 209 of file BSPImplT.hh.


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