ndtree
nd-octree data-structure and algorithms
ndtree::v1::shift_location_fn Struct Reference

Description

Shift node location.

Public Member Functions

template<typename Loc , int nd = Loc::dimension(), CONCEPT_REQUIRES_(Location< Loc >{}) >
auto operator() (Loc loc, std::array< num_t, nd > offset, uint_t level=Loc::max_level()) const noexcept-> Loc
 Shifts the location loc by normalized offset at level. More...
 
template<typename Loc , std::size_t nd, CONCEPT_REQUIRES_(Location< Loc >{}) >
auto operator() (Loc loc, std::array< int_t, nd > offset) const noexcept-> compact_optional< Loc >
 Shifts the location loc by offset. More...
 

Member Function Documentation

template<typename Loc , int nd = Loc::dimension(), CONCEPT_REQUIRES_(Location< Loc >{}) >
auto ndtree::v1::shift_location_fn::operator() ( Loc  loc,
std::array< num_t, nd >  offset,
uint_t  level = Loc::max_level() 
) const -> Loc
noexcept

Shifts the location loc by normalized offset at level.

TODO: if offset is out of bounds -> undefined behavior (right now an assertion triggers in location's constructor)

References ndtree::v1::math::ipow().

template<typename Loc , std::size_t nd, CONCEPT_REQUIRES_(Location< Loc >{}) >
auto ndtree::v1::shift_location_fn::operator() ( Loc  loc,
std::array< int_t, nd >  offset 
) const -> compact_optional<Loc>
noexcept

Shifts the location loc by offset.

If the resulting location is out-of-bounds the optional_location won't contain a valid value.