supereight
Namespaces | Macros | Functions | Variables
key_util.hpp File Reference
#include <algorithm>
#include "se/map/utils/setup_util.hpp"
#include "se/map/utils/type_util.hpp"
#include "impl/key_util_impl.hpp"

Go to the source code of this file.

Namespaces

 se
 Helper wrapper to allocate and de-allocate octants in the octree.
 
 se::keyops
 

Macros

#define NUM_DIM   3
 
#define SCALE_OFFSET   5
 
#define KEY_SCALE_LIMIT   19
 

Functions

bool se::keyops::is_valid (const se::key_t key, const se::scale_t limit=KEY_SCALE_LIMIT)
 Verify if a key is valid. More...
 
bool se::keyops::is_valid (const Eigen::Vector3i &coord)
 Verify if a coordinate can be expressed in a key. More...
 
se::code_t se::keyops::expand (unsigned long long value)
 Expands a value that can be expressed by <= 19 bits E.g. More...
 
se::key_t se::keyops::compact (uint64_t value)
 Compresses a value E.g. More...
 
bool se::keyops::encode_key (const Eigen::Vector3i &coord, const se::scale_t scale, se::key_t &key)
 Encodes given coordinates and scale in a key. More...
 
se::key_t se::keyops::encode_key (const Eigen::Vector3i &coord, const se::scale_t scale)
 Encodes given coordinates and scale in a key. More...
 
bool se::keyops::encode_key (const se::key_t code, const se::scale_t scale, se::key_t &key)
 Encodes given morton code and scale in a key. More...
 
se::key_t se::keyops::encode_key (const se::key_t code, const se::scale_t scale)
 Encodes given morton code and scale in a key. More...
 
void se::keyops::decode_key (const se::key_t key, Eigen::Vector3i &coord, scale_t &scale)
 Extracts the 3D coordinates and scale from a given key. More...
 
void se::keyops::encode_code (const Eigen::Vector3i &coord, se::code_t &code)
 Compute the Morton code for given x,y,z coordinates. More...
 
se::code_t se::keyops::encode_code (const Eigen::Vector3i &coord)
 Compute the Morton code for given x,y,z coordinates. More...
 
void se::keyops::decode_code (const se::code_t code, Eigen::Vector3i &coord)
 Compute the x,y,z coordinates for a given Morton code. More...
 
idx_t se::keyops::code_to_child_idx (const se::code_t code, const scale_t scale)
 Extracts the child index from a Morton code for a given scale. More...
 
se::code_t se::keyops::key_to_code (const se::key_t key)
 Reduce a key to only its Morton code. More...
 
Eigen::Vector3i se::keyops::key_to_coord (const se::key_t key)
 Reduce a key to only its Morton code. More...
 
scale_t se::keyops::key_to_scale (const se::key_t key)
 Reduce a key to only its scale. More...
 
bool se::keyops::key_at_scale (const se::key_t key, const se::scale_t scale, se::key_t &key_at_scale)
 For a given key, change the key scale and reduce detail from Morton code up to given the scale. More...
 
bool se::keyops::code_at_scale (const se::key_t key, const se::scale_t scale, se::code_t &code_at_scale)
 For a given key, reduce detail from Morton code up to given a scale. More...
 
void se::keyops::parent_key (const se::key_t key, se::key_t &parent_key)
 Compute the direct parent key for a given key. More...
 
se::key_t se::keyops::block_key (const se::key_t key, const se::scale_t max_block_scale)
 Removes the voxel position detail within a block from a key while maintainig the scale information. More...
 
se::code_t se::keyops::block_code (const se::key_t key, const se::scale_t max_block_scale)
 Removes the voxel position detail within a block from a code. More...
 
void se::keyops::parent_to_child_key (const se::key_t parent_key, const se::code_t code_at_scale, se::key_t &child_key)
 Compute the child key for a given parent key and child index. More...
 
bool se::keyops::is_child (const se::key_t parent_key, const se::key_t child_key)
 Verify if a key is a child of a different key. More...
 
bool se::keyops::is_siblings (const se::key_t sibling_1_key, const se::key_t sibling_2_key)
 Verify if two keys encode sibling nodes/voxels. More...
 
template<Sort = Sort::SmallToLarge>
void se::keyops::sort_keys (std::vector< se::key_t > &keys)
 Sorting template. More...
 
template<>
void se::keyops::sort_keys< Sort::SmallToLarge > (std::vector< se::key_t > &keys)
 Sorts the keys from smallest to largest. More...
 
template<>
void se::keyops::sort_keys< Sort::LargeToSmall > (std::vector< se::key_t > &keys)
 Sorts the keys from largest to smallest. More...
 
template<se::Safe SafeB>
void se::keyops::unique_keys (const std::vector< se::key_t > &keys, std::vector< se::key_t > &unique_keys)
 Filter keys based on the whole key (i.e. More...
 
template<se::Safe SafeB>
void se::keyops::unique_codes (const std::vector< se::key_t > &keys, std::vector< se::key_t > &unique_keys)
 Filter keys based on their code and keep the key with the smallest scale. More...
 
template<se::Safe SafeB>
void se::keyops::unique_allocation (const std::vector< se::key_t > &keys, const scale_t max_block_scale, std::vector< se::key_t > &unique_keys)
 Filter keys based on unique allocation. More...
 
template<se::Safe SafeB>
void se::keyops::unique_at_scale (const std::vector< se::key_t > &keys, const se::scale_t scale, std::vector< se::key_t > &unique_keys)
 Filter keys at a given scale. More...
 
void se::keyops::face_neighbours (const se::key_t key, std::array< se::key_t, 6 > face_neighbour_keys)
 TODO: 6-connectivity + centre. More...
 
void se::keyops::neighbours (const se::key_t key, std::array< se::key_t, 26 > neighbour_keys)
 TODO: 26-connectivity. More...
 
void se::keyops::siblings (const se::key_t key, std::array< se::key_t, 8 > sibling_keys)
 TODO: 4 siblings (includes key) More...
 

Variables

constexpr uint64_t se::CODE_MASK []
 #define NUM_DIM 3 uint64_t MASK[64]; MASK[0] = 0x1c0000000000000; More...
 
constexpr uint64_t se::SCALE_MASK = 0x1F
 11 111 More...
 

Macro Definition Documentation

◆ NUM_DIM

#define NUM_DIM   3

◆ SCALE_OFFSET

#define SCALE_OFFSET   5

◆ KEY_SCALE_LIMIT

#define KEY_SCALE_LIMIT   19