11#ifndef PBAT_GEOMETRY_MORTON_H
12#define PBAT_GEOMETRY_MORTON_H
14#include "pbat/HostDevice.h"
37 v = (v * 0x00010001u) & 0xFF0000FFu;
38 v = (v * 0x00000101u) & 0x0F00F00Fu;
39 v = (v * 0x00000011u) & 0xC30C30C3u;
40 v = (v * 0x00000005u) & 0x49249249u;
47concept CMorton3dPoint =
requires(Point p)
51 } -> std::convertible_to<float>;
54 } -> std::convertible_to<float>;
57 } -> std::convertible_to<float>;
68template <detail::CMorton3dPo
int Po
int>
72 using ScalarType = std::remove_cvref_t<
decltype(x[0])>;
74 min(max(x[0] * ScalarType(1024), ScalarType(0)), ScalarType(1023))));
76 min(max(x[1] * ScalarType(1024), ScalarType(0)), ScalarType(1023))));
78 min(max(x[2] * ScalarType(1024), ScalarType(0)), ScalarType(1023))));
79 return xx * 4 + yy * 2 + zz;
Geometric queries, quantities and data structures.
Definition AabbKdTreeHierarchy.h:23
PBAT_HOST_DEVICE MortonCodeType ExpandBits(MortonCodeType v)
Expands a 10-bit integer into 30 bits by inserting 2 zeros after each bit.
Definition Morton.h:35
std::uint32_t MortonCodeType
Type used to represent Morton codes.
Definition Morton.h:24
PBAT_HOST_DEVICE MortonCodeType Morton3D(Point x)
Calculates a 30-bit Morton code for the given 3D point located within the unit cube [0,...
Definition Morton.h:69
The main namespace of the library.
Definition Aliases.h:15