|
| StaticAABBTree () |
| instanciates a new empty StaticAABBTree object. More...
|
|
| StaticAABBTree (const std::vector< AABB > &leavesAABBs) |
| instanciates a new StaticAABBTree with given AABBs. More...
|
|
| ~StaticAABBTree () |
| Default destructor. More...
|
|
void | build (const std::vector< AABB > &leavesAABBs) |
| Builds the AABB tree from a list of AABBs. More...
|
|
const unsigned int | node_number () const |
|
const AABBNode | node_at_index (unsigned int nodeIndex) const |
|
const unsigned int | aabb_number () const |
|
const AABB | aabb_at_index (unsigned int aabbIndex) const |
|
const bool | is_node_leaf (unsigned int nodeIndex) const |
|
void | xraycast_aabb_tree (Ray aRay, unsigned int aNode=0) const |
| Raycasts the AABB tree using an x-oriented axis. More...
|
|
void | raycast_aabb_tree (Ray aRay, unsigned int aNode=0) const |
| Raycasts the AABB tree using an arbitrarily oriented axis. More...
|
|
void | closest_point (const double *aPoint, double &distance, unsigned int aNode=0) const |
| Finds the closest point to the query. More...
|
|
void | furthest_vertex_along_axis (const double *aPoint, const double *anAxis, double &distance, unsigned int aNode=0) const |
| Finds the furthest vertex in a given direction. More...
|
|
void | set_closest_point_callback (std::function< void(unsigned int, const double *, double &)> callback) const |
| Allows to define the callback method that will be used to check if a primitive contains a vertex closer to aPoint , resulting in a distance smaller than distance . More...
|
|
void | set_raycast_aabb_tree_callback (std::function< bool(unsigned int, Ray)> callback) const |
| Allows to define the callback method that will be used to check if a primitive is intersected by a ray. More...
|
|
void | set_furthest_vertex_callback (std::function< void(unsigned int, const double *, const double *, double &)> callback) const |
| Allows to define the callback that will be used to check if a primitive contains a vertex further to aPoint , resulting in a distance greater than distance . More...
|
|
|
unsigned int | build (std::vector< unsigned int > aabbsIndices, unsigned int depth=0) |
| Builds the AABB tree from a list of AABBs indices, for a given depth in the tree. More...
|
|
void | clear () |
| Clears the AABB tree data structure. More...
|
|
unsigned int | new_aabb_node () |
| Creates a new AABBNode. More...
|
|
unsigned int | new_aabb_node (AABB anAABB) |
| Creates a new AABBNode associated to a new AABB. More...
|
|
unsigned int | new_aabb (double minPoint[3], double maxPoint[3], unsigned int primitiveIndex=-1) |
| Creates a new AABB with given extreme points and, optionally, the primitive index. More...
|
|
unsigned int | new_aabb (AABB anAABB) |
| Creates a new AABB using the provided AABB. More...
|
|
unsigned int | new_aabb_from_aabb (const std::vector< unsigned int > &aabbs) |
| Creates a new AABB that encloses all the AABBs contained in aabbs . More...
|
|
bool | is_point_inside_aabb (const double *aPoint, unsigned int anAABB) const |
| Checks whether a point is inside an AABB. More...
|
|
double | squared_distance_to_aabb_centre (const double *aPoint, unsigned int anAABB) const |
| Computes the squared distance between a point and the AABB centre. More...
|
|
double | squared_distance_to_aabb (const double *aPoint, unsigned int anAABB) const |
| Computes the quared distance between a point and the AABB. More...
|
|
double | inner_squared_distance_to_aabb (const double *aPoint, unsigned int anAABB) const |
| Computes the inner squared distance between a point and the AABB. More...
|
|
void | furthest_vertex_on_aabb_along_axis (const double *anAxis, unsigned int anAABB, double(&furthestPoint)[3]) const |
| Finds the furthest point on an AABB along a given axis. More...
|
|
bool | is_aabb_hit_by_xray (unsigned int anAABB, Ray aRay) const |
| Checks wether an AABB is hit by an x-oriented ray. More...
|
|
bool | is_aabb_hit_by_ray (unsigned int anAABB, Ray aRay) const |
| Checks wether an AABB is hit by an arbitrarily oriented ray. More...
|
|
bool | AABBFacetIsHitByRay (unsigned int anAABB, double facetNormal[3], Ray aRay) const |
| Checks wether a facet of an AABB is hit by an arbitrarily oriented ray. More...
|
|
|
unsigned int | _aabbsCount |
| The current number of AABBs in the tree. More...
|
|
unsigned int | _node_count |
| The current number of AABB nodes in the tree. More...
|
|
std::vector< AABB > | _aabbs |
| The AABBs container. More...
|
|
std::vector< AABBNode > | _nodes |
| The AABB nodes container. More...
|
|
std::function< void(unsigned int primitiveIndex, const double *aPoint, double &distance)> | closestPointCallback_ |
| The callback used to check if a primitive with index primitiveIndex contains a vertex closer to aPoint , resulting in a distance smaller than distance . More...
|
|
std::function< bool(unsigned int primitiveIndex, Ray aRay)> | raycastAABBTreeCallback_ |
| The callback used to check if a primitive with index primitiveIndex is hit by the ray aRay . More...
|
|
std::function< void(unsigned int primitiveIndex, const double *aPoint, const double *anAxis, double &distance)> | furthestVertexCallback_ |
| The callback used to check if a vertex of a primitive with index primitiveIndex is further than the one previously found. More...
|
|
unsigned int StaticAABBTree::new_aabb |
( |
double |
minPoint[3], |
|
|
double |
maxPoint[3], |
|
|
unsigned int |
primitiveIndex = -1 |
|
) |
| |
|
private |
Creates a new AABB with given extreme points and, optionally, the primitive index.
Creates a new AABB based on the extreme points minPoint
and maxPoint
and, optionally, the primitive index, primitiveIndex
. This method invokes the static method new_lonely_aabb
to create the AABB and compute its parameters. It is then added to the list of AABBs of the tree _aabbs
.
- Returns
- The index of the newly created AABB.
AABB StaticAABBTree::new_lonely_aabb |
( |
double |
minPoint[3], |
|
|
double |
maxPoint[3], |
|
|
unsigned int |
primtiveIndex = -1 |
|
) |
| |
|
static |
Creates a new 'lonely' AABB with given extreme points.
Creates a new AABB based on the extreme points minPoint
and maxPoint
, and compute its parameters, such as its mid point, length in the three directions and volume. Optionally, a reference of the primitive it contains can be given with the primtiveIndex
argument, which defaults to -1
.
It is said 'lonely' since it is not added to the list of AABBs _aabbs
.
- Returns
- The created AABB instance.
void StaticAABBTree::raycast_aabb_tree |
( |
Ray |
aRay, |
|
|
unsigned int |
aNode = 0 |
|
) |
| const |
Raycasts the AABB tree using an arbitrarily oriented axis.
Performs a ray casting on the tree starting from node index aNode
. Each time a leaf AABB is hit by the x-oriented ray aRay
, the raycastAABBTreeCallback_
method, which must be defined using the set_raycast_aabb_tree_callback()
, is invoked. It is thus the responsibility of the program that implements the raycastAABBTreeCallback_
method to count the hit primitives, store their indices, etc.
void StaticAABBTree::xraycast_aabb_tree |
( |
Ray |
aRay, |
|
|
unsigned int |
aNode = 0 |
|
) |
| const |
Raycasts the AABB tree using an x-oriented axis.
Performs a ray casting on the tree starting from node index aNode
. Each time a leaf AABB is hit by the x-oriented ray aRay
, the raycastAABBTreeCallback_
method, which must be defined using the set_raycast_aabb_tree_callback
, is invoked. It is thus the responsibility of the program that implements the raycastAABBTreeCallback_
method to count the hit primitives, store their indices, etc.
It is a more specific version of the raycast_aabb_tree()
method, focusing only on x-oriented faces of AABBs to speed up computations. It is especially usefull to count the number of times a mesh is hit by a ray when performing containment checks.