Go to the documentation of this file.
7 #ifndef INCLUDE_JET_POINT_HASH_GRID_SEARCHER2_H_
8 #define INCLUDE_JET_POINT_HASH_GRID_SEARCHER2_H_
88 const Vector2D& origin,
double radius)
const override;
109 const std::vector<std::vector<size_t>>&
buckets()
const;
144 void serialize(std::vector<uint8_t>* buffer)
const override;
153 double _gridSpacing = 1.0;
155 std::vector<Vector2D> _points;
156 std::vector<std::vector<size_t>> _buckets;
158 size_t getHashKeyFromPosition(
const Vector2D& position)
const;
160 void getNearbyKeys(
const Vector2D& position,
size_t* bucketIndices)
const;
188 Size2 _resolution{64, 64};
189 double _gridSpacing = 1.0;
194 #endif // INCLUDE_JET_POINT_HASH_GRID_SEARCHER2_H_
2-D point class.
Definition: point2.h:23
void deserialize(const std::vector< uint8_t > &buffer) override
Deserializes the neighbor searcher from the buffer.
bool hasNearbyPoint(const Vector2D &origin, double radius) const override
Point2< ssize_t > Point2I
Integer-type 2D point.
Definition: point2.h:298
#define JET_NEIGHBOR_SEARCHER2_TYPE_NAME(DerivedClassName)
Definition: point_neighbor_searcher2.h:95
void add(const Vector2D &point)
Adds a single point to the hash grid.
1-D read-only array accessor class.
Definition: array_accessor1.h:184
Hash grid-based 2-D point searcher.
Definition: point_hash_grid_searcher2.h:25
std::shared_ptr< PointNeighborSearcher2 > PointNeighborSearcher2Ptr
Shared pointer for the PointNeighborSearcher2 type.
Definition: point_neighbor_searcher2.h:82
PointHashGridSearcher2(const PointHashGridSearcher2 &other)
Copy constructor.
void forEachNearbyPoint(const Vector2D &origin, double radius, const ForEachNearbyPointFunc &callback) const override
PointNeighborSearcher2Ptr buildPointNeighborSearcher() const override
Returns shared pointer of PointNeighborSearcher3 type.
const std::vector< std::vector< size_t > > & buckets() const
Returns the internal bucket.
void build(const ConstArrayAccessor1< Vector2D > &points) override
Builds internal acceleration structure for given points list.
std::shared_ptr< PointHashGridSearcher2 > PointHashGridSearcher2Ptr
Shared pointer for the PointHashGridSearcher2 type.
Definition: point_hash_grid_searcher2.h:164
Front-end to create PointHashGridSearcher2 objects step by step.
Definition: point_hash_grid_searcher2.h:170
void serialize(std::vector< uint8_t > *buffer) const override
Serializes the neighbor searcher into the buffer.
Definition: advection_solver2.h:18
PointHashGridSearcher2 build() const
Builds PointHashGridSearcher2 instance.
Builder & withGridSpacing(double gridSpacing)
Returns builder with grid spacing.
2-D vector class.
Definition: vector2.h:24
static Builder builder()
Returns builder fox PointHashGridSearcher2.
PointHashGridSearcher2(size_t resolutionX, size_t resolutionY, double gridSpacing)
Constructs hash grid with given resolution and grid spacing.
std::function< void(size_t, const Vector2D &)> ForEachNearbyPointFunc
Definition: point_neighbor_searcher2.h:33
PointHashGridSearcher2(const Size2 &resolution, double gridSpacing)
Constructs hash grid with given resolution and grid spacing.
Abstract base class for 2-D point neighbor searcher builders.
Definition: point_neighbor_searcher2.h:85
void set(const PointHashGridSearcher2 &other)
Copy from the other instance.
2-D size class.
Definition: size2.h:19
Point2I getBucketIndex(const Vector2D &position) const
PointHashGridSearcher2 & operator=(const PointHashGridSearcher2 &other)
Assignment operator.
Builder & withResolution(const Size2 &resolution)
Returns builder with resolution.
Abstract base class for 2-D neighbor point searcher.
Definition: point_neighbor_searcher2.h:28
PointNeighborSearcher2Ptr clone() const override
Creates a new instance of the object with same properties than original.
size_t getHashKeyFromBucketIndex(const Point2I &bucketIndex) const
PointHashGridSearcher2Ptr makeShared() const
Builds shared pointer of PointHashGridSearcher2 instance.