supereight
Loading...
Searching...
No Matches
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 <se/supereight_config.hpp>
#include "impl/key_util_impl.hpp"
Include dependency graph for key_util.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  se
 Helper wrapper to allocate and de-allocate octants in the octree.
 
namespace  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.
 
bool se::keyops::is_valid (const Eigen::Vector3i &coord)
 Verify if a coordinate can be expressed in a key.
 
se::code_t se::keyops::expand (unsigned long long value)
 Expands a value that can be expressed by <= 19 bits E.g.
 
se::key_t se::keyops::compact (uint64_t value)
 Compresses a value E.g.
 
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.
 
se::key_t se::keyops::encode_key (const Eigen::Vector3i &coord, const se::scale_t scale)
 Encodes given coordinates and scale in a key.
 
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.
 
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.
 
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.
 
void se::keyops::encode_code (const Eigen::Vector3i &coord, se::code_t &code)
 Compute the Morton code for given x,y,z coordinates.
 
se::code_t se::keyops::encode_code (const Eigen::Vector3i &coord)
 Compute the Morton code for given x,y,z coordinates.
 
void se::keyops::decode_code (const se::code_t code, Eigen::Vector3i &coord)
 Compute the x,y,z coordinates for a given Morton code.
 
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.
 
se::code_t se::keyops::key_to_code (const se::key_t key)
 Reduce a key to only its Morton code.
 
Eigen::Vector3i se::keyops::key_to_coord (const se::key_t key)
 Reduce a key to only its Morton code.
 
scale_t se::keyops::key_to_scale (const se::key_t key)
 Reduce a key to only its scale.
 
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.
 
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.
 
void se::keyops::parent_key (const se::key_t key, se::key_t &parent_key)
 Compute the direct parent key for a given key.
 
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.
 
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.
 
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.
 
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.
 
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.
 
template<Sort = Sort::SmallToLarge>
void se::keyops::sort_keys (std::vector< se::key_t > &keys)
 Sorting template.
 
template<>
void se::keyops::sort_keys< Sort::SmallToLarge > (std::vector< se::key_t > &keys)
 Sorts the keys from smallest to largest.
 
template<>
void se::keyops::sort_keys< Sort::LargeToSmall > (std::vector< se::key_t > &keys)
 Sorts the keys from largest to smallest.
 
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.
 
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.
 
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.
 
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.
 
void se::keyops::face_neighbours (const se::key_t key, std::array< se::key_t, 6 > face_neighbour_keys)
 TODO: 6-connectivity + centre.
 
void se::keyops::neighbours (const se::key_t key, std::array< se::key_t, 26 > neighbour_keys)
 TODO: 26-connectivity.
 
void se::keyops::siblings (const se::key_t key, std::array< se::key_t, 8 > sibling_keys)
 TODO: 4 siblings (includes key)
 

Variables

constexpr uint64_t se::CODE_MASK []
 The code mask for a given scale.
 
constexpr uint64_t se::SCALE_MASK = 0x1F
 11 111
 

Macro Definition Documentation

◆ NUM_DIM

#define NUM_DIM   3

◆ SCALE_OFFSET

#define SCALE_OFFSET   5

◆ KEY_SCALE_LIMIT

#define KEY_SCALE_LIMIT   19