libatomprobe
Library for Atom Probe Tomography (APT) computation
|
3D specific KD tree More...
#include <K3DTree-exact.h>
Public Member Functions | |
K3DTreeExact () | |
KD Tree constructor. Tree is uninitialised at start. More... | |
~K3DTreeExact () | |
Cleans up tree, deallocates nodes. More... | |
void | resetPts (std::vector< Point3D > &pts, bool clear=true) |
Supply points to KD tree. Ouput vector will be erased if clear=true. More... | |
void | resetPts (std::vector< IonHit > &pts, bool clear=true) |
Supply points using IonHits to KD tree. Ouput vector will be erased if clear=true. More... | |
bool | build () |
Build the KD tree using the previously supplied points. More... | |
void | getBoundCube (BoundCube &b) |
obtain the bounding rectangular prism volume for all elements in the KD tree More... | |
void | dump (std::ostream &, size_t depth=0, size_t offset=-1) const |
Textual output of tree. Tabs are used to separate different levels of the tree. More... | |
size_t | findNearestUntagged (const Point3D &queryPt, const BoundCube &b, bool tag=true) |
Find the nearest "untagged" point's internal index. More... | |
void | findUntaggedInRadius (const Point3D &queryPt, const BoundCube &b, float radius, std::vector< size_t > &result) |
Find untagged points within a given radius. More... | |
void | ptsInSphere (const Point3D &origin, float radius, std::vector< size_t > &pts) const |
const Point3D * | getPt (size_t index) const |
const Point3D & | getPtRef (size_t index) const |
void | clearTags (std::vector< size_t > &tagsToClear) |
size_t | getOrigIndex (size_t treeIndex) const |
void | setCallback (bool(*cb)(void)) |
void | setProgressPointer (unsigned int *p) |
void | clear () |
void | tag (size_t treeIndex, bool tagVal=true) |
void | tag (const std::vector< size_t > &treeIndicies, bool tagVal=true) |
bool | getTag (size_t treeIndex) const |
size_t | size () const |
size_t | rootIdx () const |
size_t | tagCount () const |
void | clearAllTags () |
3D specific KD tree
Definition at line 54 of file K3DTree-exact.h.
K3DTreeExact::K3DTreeExact | ( | ) |
KD Tree constructor. Tree is uninitialised at start.
Note : must set progress pointer and callback
Definition at line 65 of file K3DTree-exact.cpp.
|
inline |
Cleans up tree, deallocates nodes.
Definition at line 85 of file K3DTree-exact.h.
bool K3DTreeExact::build | ( | ) |
Build the KD tree using the previously supplied points.
Builds a balanced KD tree from a list of points previously set by "resetPts". Callback and progress pointers must be set.
Definition at line 162 of file K3DTree-exact.cpp.
References ASSERT, clearAllTags(), AtomProbe::PROGRESS_REDUCE, and AxisCompareExact::setAxis().
Referenced by clearAllTags(), kdExactFuzz(), and main().
|
inline |
Definition at line 149 of file K3DTree-exact.h.
void K3DTreeExact::clearAllTags | ( | ) |
Definition at line 787 of file K3DTree-exact.cpp.
References ASSERT, build(), getPt(), ptsInSphere(), resetPts(), setCallback(), setProgressPointer(), AtomProbe::Point3D::sqrDist(), and TEST.
Referenced by build().
void K3DTreeExact::clearTags | ( | std::vector< size_t > & | tagsToClear | ) |
Definition at line 780 of file K3DTree-exact.cpp.
void K3DTreeExact::dump | ( | std::ostream & | strm, |
size_t | depth = 0 , |
||
size_t | offset = -1 |
||
) | const |
Textual output of tree. Tabs are used to separate different levels of the tree.
The output from this function can be quite large for even modest trees. Recommended for debugging only
Definition at line 333 of file K3DTree-exact.cpp.
size_t K3DTreeExact::findNearestUntagged | ( | const Point3D & | queryPt, |
const BoundCube & | b, | ||
bool | tag = true |
||
) |
Find the nearest "untagged" point's internal index.
The point found is marked as "tagged" in the tree by default. -Returns -1 on failure (no untagged points), otherwise index of point
Definition at line 475 of file K3DTree-exact.cpp.
References ASSERT, and AtomProbe::BoundCube::intersects().
Referenced by findUntaggedInRadius(), and main().
void K3DTreeExact::findUntaggedInRadius | ( | const Point3D & | queryPt, |
const BoundCube & | b, | ||
float | radius, | ||
std::vector< size_t > & | result | ||
) |
Find untagged points within a given radius.
This is not thread safe - tags are read/written during operation
Definition at line 724 of file K3DTree-exact.cpp.
References ASSERT, findNearestUntagged(), getPtRef(), size(), AtomProbe::Point3D::sqrDist(), and tag().
Referenced by kdExactFuzz(), and main().
void K3DTreeExact::getBoundCube | ( | BoundCube & | b | ) |
obtain the bounding rectangular prism volume for all elements in the KD tree
Definition at line 69 of file K3DTree-exact.cpp.
References ASSERT, and AtomProbe::BoundCube::setBounds().
Referenced by kdExactFuzz(), and main().
size_t K3DTreeExact::getOrigIndex | ( | size_t | treeIndex | ) | const |
const Point3D * K3DTreeExact::getPt | ( | size_t | index | ) | const |
const Point3D & K3DTreeExact::getPtRef | ( | size_t | index | ) | const |
Definition at line 81 of file K3DTree-exact.cpp.
References ASSERT.
Referenced by findUntaggedInRadius(), AtomProbe::generate1DAxialDistHist(), AtomProbe::generate1DAxialDistHistSweep(), kdExactFuzz(), and main().
bool K3DTreeExact::getTag | ( | size_t | treeIndex | ) | const |
Definition at line 93 of file K3DTree-exact.cpp.
References ASSERT.
void K3DTreeExact::ptsInSphere | ( | const Point3D & | origin, |
float | radius, | ||
std::vector< size_t > & | pts | ||
) | const |
Definition at line 379 of file K3DTree-exact.cpp.
References ASSERT, AtomProbe::BoundCube::containedInSphere(), and AtomProbe::BoundCube::intersects().
Referenced by clearAllTags(), AtomProbe::generate1DAxialDistHist(), AtomProbe::generate1DAxialDistHistSweep(), kdExactFuzz(), and main().
void K3DTreeExact::resetPts | ( | std::vector< Point3D > & | pts, |
bool | clear = true |
||
) |
Supply points to KD tree. Ouput vector will be erased if clear=true.
Definition at line 119 of file K3DTree-exact.cpp.
References AtomProbe::BoundCube::setBounds().
Referenced by clearAllTags(), kdExactFuzz(), and main().
void K3DTreeExact::resetPts | ( | std::vector< IonHit > & | pts, |
bool | clear = true |
||
) |
Supply points using IonHits to KD tree. Ouput vector will be erased if clear=true.
Definition at line 138 of file K3DTree-exact.cpp.
References AtomProbe::IonHit::getIonDataLimits().
|
inline |
Definition at line 163 of file K3DTree-exact.h.
|
inline |
Definition at line 143 of file K3DTree-exact.h.
References callback().
Referenced by clearAllTags(), kdExactFuzz(), and main().
|
inline |
Definition at line 146 of file K3DTree-exact.h.
Referenced by clearAllTags(), kdExactFuzz(), and main().
size_t K3DTreeExact::size | ( | ) | const |
Definition at line 113 of file K3DTree-exact.cpp.
References ASSERT.
Referenced by findUntaggedInRadius(), AtomProbe::generate1DAxialDistHistSweep(), kdExactFuzz(), and main().
void K3DTreeExact::tag | ( | size_t | treeIndex, |
bool | tagVal = true |
||
) |
Definition at line 99 of file K3DTree-exact.cpp.
References ASSERT.
Referenced by findUntaggedInRadius().
void K3DTreeExact::tag | ( | const std::vector< size_t > & | treeIndicies, |
bool | tagVal = true |
||
) |
Definition at line 105 of file K3DTree-exact.cpp.
References ASSERT.
size_t K3DTreeExact::tagCount | ( | ) | const |
Definition at line 765 of file K3DTree-exact.cpp.