The SkdPatchInfo class defines a node of the skd-tree. More...
Public Types | |
enum | ChildLocation { CHILD_LEFT = 0 , CHILD_RIGHT = 1 , CHILD_BEGIN = 0 , CHILD_END = 2 } |
Public Member Functions | |
SkdNode () | |
SkdNode (const SkdPatchInfo *patchInfo, std::size_t cellRangeBegin, std::size_t cellRangeEnd) | |
std::array< double, 3 > | evalBoxWeightedMean () const |
double | evalBoxWeightedMean (int direction) const |
double | evalPointDistance (const std::array< double, 3 > &point, bool interiorCellsOnly) const |
void | findPointClosestCell (const std::array< double, 3 > &point, bool interiorCellsOnly, long *closestId, double *closestDistance) const |
const SkdBox & | getBoundingBox () const |
long | getCell (std::size_t n) const |
std::size_t | getCellCount () const |
std::vector< long > | getCells () const |
std::size_t | getChildId (ChildLocation child) const |
bool | hasChild (ChildLocation child) const |
bool | isLeaf () const |
void | updatePointClosestCell (const std::array< double, 3 > &point, bool interiorCellsOnly, long *closestId, double *closestDistance) const |
void | updatePointClosestCells (const std::array< double, 3 > &point, bool interiorCellsOnly, std::vector< long > *closestIds, double *closestDistance) const |
Public Member Functions inherited from bitpit::SkdBox | |
SkdBox () | |
SkdBox (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax) | |
bool | boxContainsPoint (const std::array< double, 3 > &point, double offset) const |
bool | boxIntersectsSphere (const std::array< double, 3 > ¢er, double radius) const |
double | evalPointMaxDistance (const std::array< double, 3 > &point) const |
double | evalPointMaxDistance (const std::array< double, 3 > &point, double emptyDistance) const |
double | evalPointMaxSquareDistance (const std::array< double, 3 > &point) const |
double | evalPointMaxSquareDistance (const std::array< double, 3 > &point, double emptySquareDistance) const |
double | evalPointMinDistance (const std::array< double, 3 > &point) const |
double | evalPointMinDistance (const std::array< double, 3 > &point, double emptyDistance) const |
double | evalPointMinSquareDistance (const std::array< double, 3 > &point) const |
double | evalPointMinSquareDistance (const std::array< double, 3 > &point, double emptySquareDistance) const |
const std::array< double, 3 > & | getBoxMax () const |
const std::array< double, 3 > & | getBoxMin () const |
bool | isEmpty () const |
Static Public Attributes | |
BITPIT_PUBLIC_API static constexpr const int | MAX_CHILDREN = 2 |
static BITPIT_PUBLIC_API const std::size_t | NULL_ID = std::numeric_limits<std::size_t>::max() |
Friends | |
class | PatchSkdTree |
Additional Inherited Members | |
Protected Attributes inherited from bitpit::SkdBox | |
std::array< double, 3 > | m_boxMax |
std::array< double, 3 > | m_boxMin |
The SkdPatchInfo class defines a node of the skd-tree.
Definition at line 96 of file patch_skd_tree.hpp.
enum bitpit::SkdNode::ChildLocation |
Definition at line 105 of file patch_skd_tree.hpp.
bitpit::SkdNode::SkdNode | ( | ) |
Default constructor.
Definition at line 442 of file patch_skd_tree.cpp.
bitpit::SkdNode::SkdNode | ( | const SkdPatchInfo * | patchInfo, |
std::size_t | cellRangeBegin, | ||
std::size_t | cellRangeEnd ) |
Constructor
patchInfo | are the patch information |
cellRangeBegin | is the index of the first cell enclosed in the bounding box associated to the node |
cellRangeEnd | is the index of the past-the-end cell enclosed in the bounding box associated to the node |
Definition at line 458 of file patch_skd_tree.cpp.
std::array< double, 3 > bitpit::SkdNode::evalBoxWeightedMean | ( | ) | const |
Evaluates the weighted centroid of the bounding box associated to the node.
Definition at line 573 of file patch_skd_tree.cpp.
double bitpit::SkdNode::evalBoxWeightedMean | ( | int | direction | ) | const |
Evaluates the weighted centroid along the specified direction of the bounding box associated with the node.
direction | is the direction along which the centroid is requested |
Definition at line 595 of file patch_skd_tree.cpp.
double bitpit::SkdNode::evalPointDistance | ( | const std::array< double, 3 > & | point, |
bool | interiorCellsOnly ) const |
Computes the distance between the specified point and the closest cell contained in the bounding box associated to the node.
point | is the point |
interiorCellsOnly | if set to true, only interior cells will be considered, it will be possible to consider non-interior cells only if the tree has been instantiated with non-interior cells support enabled |
Definition at line 659 of file patch_skd_tree.cpp.
void bitpit::SkdNode::findPointClosestCell | ( | const std::array< double, 3 > & | point, |
bool | interiorCellsOnly, | ||
long * | id, | ||
double * | closestDistance ) const |
Given the specified point find the closest cell contained in the bounding box associated to the node and evaluates the distance between that cell and the given point.
point | is the point | |
interiorCellsOnly | if set to true, only interior cells will be considered, it will be possible to consider non-interior cells only if the tree has been instantiated with non-interior cells support enabled | |
[out] | id | on output it will contain the id of the closest cell |
[out] | closestDistance | on output it will contain the distance between the point and the closest cell |
Definition at line 682 of file patch_skd_tree.cpp.
const SkdBox & bitpit::SkdNode::getBoundingBox | ( | ) | const |
Get the bounding box associated to the node.
Definition at line 561 of file patch_skd_tree.cpp.
long bitpit::SkdNode::getCell | ( | std::size_t | n | ) | const |
Get the n-th cell enclosed in the bounding box associated to the node.
n | is the index of the requested cell |
Definition at line 523 of file patch_skd_tree.cpp.
std::size_t bitpit::SkdNode::getCellCount | ( | ) | const |
Count the cells enclosed in the bounding box associated to the node.
Definition at line 512 of file patch_skd_tree.cpp.
std::vector< long > bitpit::SkdNode::getCells | ( | ) | const |
Get the list of cells enclosed in the bounding box associated to the node.
Definition at line 540 of file patch_skd_tree.cpp.
std::size_t bitpit::SkdNode::getChildId | ( | ChildLocation | child | ) | const |
Get the id of the specified child.
child | is the child that has to reteived |
Definition at line 643 of file patch_skd_tree.cpp.
bool bitpit::SkdNode::hasChild | ( | ChildLocation | child | ) | const |
Checks if a node has the specified child.
child | is the child that has to be checked |
Definition at line 632 of file patch_skd_tree.cpp.
bool bitpit::SkdNode::isLeaf | ( | ) | const |
Checks if a node is a leaf.
Definition at line 614 of file patch_skd_tree.cpp.
void bitpit::SkdNode::updatePointClosestCell | ( | const std::array< double, 3 > & | point, |
bool | interiorCellsOnly, | ||
long * | closestId, | ||
double * | closestDistance ) const |
Given the specified point find if, among the cells contained in the bounding box associated to the node, there is a cell closer to the one received in input.
If two cells have the same distance, the closest cell will be chosen using the normal of the cells: the cell more "aligned" with the line that connect the specified point and its projection onto the cell will be chosen.
point | is the point | |
interiorCellsOnly | if set to true, only interior cells will be considered, it will be possible to consider non-interior cells only if the tree has been instantiated with non-interior cells support enabled | |
[in,out] | closestId | is the id of the current closest cell, on output it will be updated if a closer cell is found |
[in,out] | closestDistance | is the distance of the current closest cell, on output it will be updated if a closer cell is found |
Definition at line 709 of file patch_skd_tree.cpp.
void bitpit::SkdNode::updatePointClosestCells | ( | const std::array< double, 3 > & | point, |
bool | interiorCellsOnly, | ||
std::vector< long > * | closestIds, | ||
double * | closestDistance ) const |
Given the specified point find if, among the cells contained in the bounding box associated to the node, there are cells closer to the one received in input.
In output all the cells at minimal distance from the given point are provided.
point | is the point | |
interiorCellsOnly | if set to true, only interior cells will be considered, it will be possible to consider non-interior cells only if the tree has been instantiated with non-interior cells support enabled | |
[in,out] | closestIds | are the indices of the closest cells, on output it will be updated if the specified cell is closer than the current closest cells or it is at the same distance. |
[in,out] | closestDistance | is the distance of the current closest cells, on output it will be updated if closer cells are found |
Definition at line 802 of file patch_skd_tree.cpp.
|
friend |
Definition at line 98 of file patch_skd_tree.hpp.
|
staticconstexpr |
Definition at line 103 of file patch_skd_tree.hpp.
|
static |
Null node id
Definition at line 101 of file patch_skd_tree.hpp.