30template<
typename Po
intOut,
typename Po
intIn>
63 [[nodiscard]]
double &
operator[](
size_t index);
73 [[nodiscard]] int32_t &
operator[](
size_t index);
88 static_cast<int32_t
>(std::floor(point.
x * inv_resolution)),
89 static_cast<int32_t
>(std::floor(point.
y * inv_resolution)),
90 static_cast<int32_t
>(std::floor(point.
z * inv_resolution))};
96 (
static_cast<double>(coord.
x)) * resolution, (
static_cast<double>(coord.
y)) * resolution,
97 (
static_cast<double>(coord.
z)) * resolution};
119 throw std::runtime_error(
"out of bound index");
124template<
class T,
class =
void>
129template<
class T,
class =
void>
136template<
typename T,
typename A>
142template<
typename Po
intOut,
typename Po
intIn>
146 static_assert(std::is_same_v<PointIn, PointOut>||
150 "Can't convert from the specified type");
152 static_assert(std::is_same_v<PointIn, PointOut>||
156 "Can't convert to the specified type");
159 if constexpr (std::is_same_v<PointIn, PointOut>) {
163 return {v.x(), v.y(), v.z()};
166 return {v.x, v.y, v.z};
169 return {v[0], v[1], v[2]};
183 throw std::runtime_error(
"out of bound index");
189 return x == other.
x &&
y == other.
y &&
z == other.
z;
194 return !(*
this == other);
199 return {
x + other.
x,
y + other.
y,
z + other.
z};
204 return {
x - other.
x,
y - other.
y,
z - other.
z};
233 return ((1 << 20) - 1) & (
static_cast<int64_t
>(p.
x) * 73856093 ^
234 static_cast<int64_t
>(p.
y) * 19349669 ^
235 static_cast<int64_t
>(p.
z) * 83492791);
CoordT PosToCoord(const Point3D &point, double inv_resolution)
Definition grid_coord.hpp:85
Point3D CoordToPos(const CoordT &coord, double resolution)
Definition grid_coord.hpp:93
PointOut ConvertPoint(const PointIn &v)
Definition grid_coord.hpp:143
Definition grid_coord.hpp:226
Definition grid_coord.hpp:67
CoordT & operator-=(const CoordT &other)
Definition grid_coord.hpp:215
bool operator==(const CoordT &other) const
Definition grid_coord.hpp:187
CoordT operator+(const CoordT &other) const
Definition grid_coord.hpp:197
int32_t & operator[](size_t index)
Definition grid_coord.hpp:173
CoordT operator-(const CoordT &other) const
Definition grid_coord.hpp:202
bool operator!=(const CoordT &other) const
Definition grid_coord.hpp:192
int32_t z
Definition grid_coord.hpp:70
CoordT & operator+=(const CoordT &other)
Definition grid_coord.hpp:207
int32_t y
Definition grid_coord.hpp:69
int32_t x
Definition grid_coord.hpp:68
Definition grid_coord.hpp:34
Point3D & operator=(const T &v)
Definition grid_coord.hpp:56
double & operator[](size_t index)
Definition grid_coord.hpp:109
Point3D(const T &v)
Definition grid_coord.hpp:50
Point3D & operator=(Point3D &&v)=default
Point3D(Point3D &&v)=default
double z
Definition grid_coord.hpp:37
double y
Definition grid_coord.hpp:36
Point3D & operator=(const Point3D &v)=default
double x
Definition grid_coord.hpp:35
Point3D(const Point3D &v)=default
Definition grid_coord.hpp:130
Definition grid_coord.hpp:125
Definition grid_coord.hpp:135
std::size_t operator()(const Bonxai::CoordT &p) const
Definition grid_coord.hpp:230