Autoware.Auto
autoware::common::geometry::spatial_hash::Config2d Class Reference

Configuration class for a 2d spatial hash. More...

#include <spatial_hash_config.hpp>

Inheritance diagram for autoware::common::geometry::spatial_hash::Config2d:
Collaboration diagram for autoware::common::geometry::spatial_hash::Config2d:

Public Member Functions

 Config2d (const float32_t min_x, const float32_t max_x, const float32_t min_y, const float32_t max_y, const float32_t radius, const Index capacity)
 Config constructor for 2D spatial hash. More...
 
Index bin_ (const float32_t x, const float32_t y, const float32_t z) const
 The index of a point given it's x, y and z values, 2d implementation. More...
 
bool valid (const details::Index3 &ref, const details::Index3 &query, const float ref_distance2) const
 Determine if a bin could possibly hold a point within a distance to any point in a reference bin for the 2D case. More...
 
details::Index3 index3_ (const float32_t x, const float32_t y, const float32_t z) const
 Compute the decomposed index given a point, 2d implementation. More...
 
Index index_ (const details::Index3 &idx) const
 Compute the composed single index given a decomposed index, 2d implementation. More...
 
template<typename PointT >
float32_t distance_squared_ (const float32_t x, const float32_t y, const float32_t z, const PointT &pt) const
 Compute the squared distance between the two points, 2d implementation. More...
 
- Public Member Functions inherited from autoware::common::geometry::spatial_hash::Config< Config2d >
 Config (const float32_t min_x, const float32_t max_x, const float32_t min_y, const float32_t max_y, const float32_t min_z, const float32_t max_z, const float32_t radius, const Index capacity)
 Constructor for spatial hash. More...
 
details::BinRange bin_range (const details::Index3 &ref, const float radius) const
 Given a reference index triple, compute the first and last bin. More...
 
bool8_t next_bin (const details::BinRange &range, details::Index3 &idx) const
 Get next index within a given range. More...
 
Index get_capacity () const
 Get the maximum capacity of the spatial hash. More...
 
float32_t radius2 () const
 Getter for the side length, equivalently the lookup radius. More...
 
Index bin (const float32_t x, const float32_t y, const float32_t z) const
 Compute the single index given a point. More...
 
bool is_candidate_bin (const details::Index3 &ref, const details::Index3 &query, const float ref_distance2) const
 Compute whether the query bin and reference bin could possibly contain a pair of points such that their distance is within a certain threshold. More...
 
details::Index3 index3 (const float32_t x, const float32_t y, const float32_t z) const
 Compute the decomposed index given a point. More...
 
Index index (const details::Index3 &idx) const
 Compute the composed single index given a decomposed index. More...
 
float32_t distance_squared (const float32_t x, const float32_t y, const float32_t z, const PointT &pt) const
 Compute the squared distance between the two points. More...
 

Additional Inherited Members

- Protected Member Functions inherited from autoware::common::geometry::spatial_hash::Config< Config2d >
Index x_index (const float32_t x) const
 Computes the index in the x basis direction. More...
 
Index y_index (const float32_t y) const
 Computes the index in the y basis direction. More...
 
Index z_index (const float32_t z) const
 Computes the index in the z basis direction. More...
 
Index bin_impl (const Index xdx, const Index ydx) const
 Compose the provided index offsets. More...
 
Index bin_impl (const Index xdx, const Index ydx, const Index zdx) const
 Compose the provided index offsets. More...
 
Index bin_impl (const float32_t x, const float32_t y) const
 The index offset of a point given it's x and y values. More...
 
Index bin_impl (const float32_t x, const float32_t y, const float32_t z) const
 The index of a point given it's x, y and z values. More...
 
float32_t idx_distance (const Index ref_idx, const Index query_idx) const
 The distance between two indices as a float, where adjacent indices have zero distance (e.g. dist(0, 1) = 0) More...
 
float side_length2 () const
 Get side length squared. More...
 
- Protected Member Functions inherited from autoware::common::helper_functions::crtp< Config2d >
const Config2d & impl () const
 
Config2d & impl ()
 

Detailed Description

Configuration class for a 2d spatial hash.

Constructor & Destructor Documentation

◆ Config2d()

autoware::common::geometry::spatial_hash::Config2d::Config2d ( const float32_t  min_x,
const float32_t  max_x,
const float32_t  min_y,
const float32_t  max_y,
const float32_t  radius,
const Index  capacity 
)

Config constructor for 2D spatial hash.

Parameters
[in]min_xThe minimum x value for the spatial hash
[in]max_xThe maximum x value for the spatial hash
[in]min_yThe minimum y value for the spatial hash
[in]max_yThe maximum y value for the spatial hash
[in]radiusThe lookup distance
[in]capacityThe maximum number of points the spatial hash can store

Member Function Documentation

◆ bin_()

Index autoware::common::geometry::spatial_hash::Config2d::bin_ ( const float32_t  x,
const float32_t  y,
const float32_t  z 
) const

The index of a point given it's x, y and z values, 2d implementation.

Parameters
[in]xThe x value of a point
[in]ythe y value of a point
[in]zthe z value of a point
Returns
The index of the bin for the specified point

◆ distance_squared_()

template<typename PointT >
float32_t autoware::common::geometry::spatial_hash::Config2d::distance_squared_ ( const float32_t  x,
const float32_t  y,
const float32_t  z,
const PointT &  pt 
) const
inline

Compute the squared distance between the two points, 2d implementation.

Template Parameters
PointTA point type with float members x, y and z, or point adapters defined
Parameters
[in]xThe x component of the first point
[in]yThe y component of the first point
[in]zThe z component of the first point
[in]ptThe other point being compared
Returns
The squared distance between the points (2d)

◆ index3_()

details::Index3 autoware::common::geometry::spatial_hash::Config2d::index3_ ( const float32_t  x,
const float32_t  y,
const float32_t  z 
) const

Compute the decomposed index given a point, 2d implementation.

Parameters
[in]xThe x component of the point
[in]yThe y component of the point
[in]zThe z component of the point
Returns
The decomposed index triple of the bin for the given point

◆ index_()

Index autoware::common::geometry::spatial_hash::Config2d::index_ ( const details::Index3 idx) const

Compute the composed single index given a decomposed index, 2d implementation.

Parameters
[in]idxA decomposed index triple for a bin
Returns
The composed bin index

◆ valid()

bool autoware::common::geometry::spatial_hash::Config2d::valid ( const details::Index3 ref,
const details::Index3 query,
const float  ref_distance2 
) const

Determine if a bin could possibly hold a point within a distance to any point in a reference bin for the 2D case.

Parameters
[in]refThe decomposed index triple of the reference bin
[in]queryThe decomposed index triple of the bin being queried
[in]ref_distance2The squared threshold distance
Returns
True if the reference bin and query bin could possibly hold a point within the reference distance

The documentation for this class was generated from the following files: