Hash grid-based 2-D point searcher. More...
#include <Core/Searcher/PointHashGridSearcher2.h>
Classes | |
class | Builder |
Front-end to create PointHashGridSearcher2 objects step by step. More... | |
Public Member Functions | |
PointHashGridSearcher2 (const Size2 &resolution, double gridSpacing) | |
Constructs hash grid with given resolution and grid spacing. More... | |
PointHashGridSearcher2 (size_t resolutionX, size_t resolutionY, double gridSpacing) | |
Constructs hash grid with given resolution and grid spacing. More... | |
PointHashGridSearcher2 (const PointHashGridSearcher2 &other) | |
Copy constructor. More... | |
void | Build (const ConstArrayAccessor1< Vector2D > &points) override |
Builds internal acceleration structure for given points list. More... | |
void | ForEachNearbyPoint (const Vector2D &origin, double radius, const ForEachNearbyPointFunc &callback) const override |
bool | HasNearbyPoint (const Vector2D &origin, double radius) const override |
void | Add (const Vector2D &point) |
Adds a single point to the hash grid. More... | |
const std::vector< std::vector< size_t > > & | GetBuckets () const |
Returns the internal bucket. More... | |
size_t | GetHashKeyFromBucketIndex (const Point2I &bucketIndex) const |
Point2I | GetBucketIndex (const Vector2D &position) const |
PointNeighborSearcher2Ptr | Clone () const override |
Creates a new instance of the object with same properties than original. More... | |
PointHashGridSearcher2 & | operator= (const PointHashGridSearcher2 &other) |
Assignment operator. More... | |
void | Set (const PointHashGridSearcher2 &other) |
Copy from the other instance. More... | |
void | Serialize (std::vector< uint8_t > *buffer) const override |
Serializes the neighbor searcher into the buffer. More... | |
void | Deserialize (const std::vector< uint8_t > &buffer) override |
Deserializes the neighbor searcher from the buffer. More... | |
Public Member Functions inherited from CubbyFlow::PointNeighborSearcher2 | |
PointNeighborSearcher2 () | |
Default constructor. More... | |
virtual | ~PointNeighborSearcher2 () |
Destructor. More... | |
virtual std::string | TypeName () const =0 |
Returns the type name of the derived class. More... | |
Static Public Member Functions | |
static Builder | GetBuilder () |
Returns builder fox PointHashGridSearcher2. More... | |
Additional Inherited Members | |
Public Types inherited from CubbyFlow::PointNeighborSearcher2 | |
using | ForEachNearbyPointFunc = std::function< void(size_t, const Vector2D &)> |
Detailed Description
Hash grid-based 2-D point searcher.
This class implements 2-D point searcher by using hash grid for its internal acceleration data structure. Each point is recorded to its corresponding bucket where the hashing function is 2-D grid mapping.
Constructor & Destructor Documentation
◆ PointHashGridSearcher2() [1/3]
CubbyFlow::PointHashGridSearcher2::PointHashGridSearcher2 | ( | const Size2 & | resolution, |
double | gridSpacing | ||
) |
Constructs hash grid with given resolution and grid spacing.
This constructor takes hash grid resolution and its grid spacing as its input parameters. The grid spacing must be 2x or greater than search radius.
- Parameters
-
[in] resolution The resolution. [in] gridSpacing The grid spacing.
◆ PointHashGridSearcher2() [2/3]
CubbyFlow::PointHashGridSearcher2::PointHashGridSearcher2 | ( | size_t | resolutionX, |
size_t | resolutionY, | ||
double | gridSpacing | ||
) |
Constructs hash grid with given resolution and grid spacing.
This constructor takes hash grid resolution and its grid spacing as its input parameters. The grid spacing must be 2x or greater than search radius.
- Parameters
-
[in] resolutionX The resolution x. [in] resolutionY The resolution y. [in] gridSpacing The grid spacing.
◆ PointHashGridSearcher2() [3/3]
CubbyFlow::PointHashGridSearcher2::PointHashGridSearcher2 | ( | const PointHashGridSearcher2 & | other | ) |
Copy constructor.
Member Function Documentation
◆ Add()
void CubbyFlow::PointHashGridSearcher2::Add | ( | const Vector2D & | point | ) |
Adds a single point to the hash grid.
This function adds a single point to the hash grid for future queries. It can be used for a hash grid that is already built by calling function PointHashGridSearcher2::build.
- Parameters
-
[in] point The point to be added.
◆ Build()
|
overridevirtual |
Builds internal acceleration structure for given points list.
Implements CubbyFlow::PointNeighborSearcher2.
◆ Clone()
|
overridevirtual |
Creates a new instance of the object with same properties than original.
- Returns
- Copy of this object.
Implements CubbyFlow::PointNeighborSearcher2.
◆ Deserialize()
|
overridevirtual |
Deserializes the neighbor searcher from the buffer.
Implements CubbyFlow::Serializable.
◆ ForEachNearbyPoint()
|
overridevirtual |
Invokes the callback function for each nearby point around the origin within given radius.
- Parameters
-
[in] origin The origin position. [in] radius The search radius. [in] callback The callback function.
Implements CubbyFlow::PointNeighborSearcher2.
◆ GetBucketIndex()
Gets the bucket index from a point.
- Parameters
-
[in] position The position of the point.
- Returns
- The bucket index.
◆ GetBuckets()
const std::vector<std::vector<size_t> >& CubbyFlow::PointHashGridSearcher2::GetBuckets | ( | ) | const |
Returns the internal bucket.
A bucket is a list of point indices that has same hash value. This function returns the (immutable) internal bucket structure.
- Returns
- List of buckets.
◆ GetBuilder()
|
static |
Returns builder fox PointHashGridSearcher2.
◆ GetHashKeyFromBucketIndex()
size_t CubbyFlow::PointHashGridSearcher2::GetHashKeyFromBucketIndex | ( | const Point2I & | bucketIndex | ) | const |
Returns the hash value for given 2-D bucket index.
- Parameters
-
[in] bucketIndex The bucket index.
- Returns
- The hash key from bucket index.
◆ HasNearbyPoint()
|
overridevirtual |
Returns true if there are any nearby points for given origin within radius.
- Parameters
-
[in] origin The origin. [in] radius The radius.
- Returns
- True if has nearby point, false otherwise.
Implements CubbyFlow::PointNeighborSearcher2.
◆ operator=()
PointHashGridSearcher2& CubbyFlow::PointHashGridSearcher2::operator= | ( | const PointHashGridSearcher2 & | other | ) |
Assignment operator.
◆ Serialize()
|
overridevirtual |
Serializes the neighbor searcher into the buffer.
Implements CubbyFlow::Serializable.
◆ Set()
void CubbyFlow::PointHashGridSearcher2::Set | ( | const PointHashGridSearcher2 & | other | ) |
Copy from the other instance.
The documentation for this class was generated from the following file:
- Core/Searcher/PointHashGridSearcher2.h