supereight
Loading...
Searching...
No Matches
visitor.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016-2019 Emanuele Vespa
3 * SPDX-FileCopyrightText: 2019-2023 Smart Robotics Lab, Imperial College London, Technical University of Munich
4 * SPDX-FileCopyrightText: 2019-2023 Nils Funk
5 * SPDX-FileCopyrightText: 2021-2023 Sotiris Papatheodorou
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#ifndef SE_VISITOR_HPP
10#define SE_VISITOR_HPP
11
12#include <optional>
15
19namespace se {
20namespace visitor {
21
22
23
25
37template<typename OctreeT>
38typename OctreeT::DataType getData(const OctreeT& octree, const Eigen::Vector3i& voxel_coord);
39
54template<typename OctreeT, typename BlockT>
55typename OctreeT::DataType
56getData(const OctreeT& octree, BlockT* block_ptr, const Eigen::Vector3i& voxel_coord);
57
58
59
61
74template<typename OctreeT>
75typename std::enable_if_t<OctreeT::res_ == Res::Multi, typename OctreeT::DataType>
77 const Eigen::Vector3i& voxel_coord,
78 const int scale_desired,
79 int& scale_returned);
80
96template<typename OctreeT, typename BlockT>
97typename std::enable_if_t<OctreeT::res_ == Res::Multi, typename OctreeT::DataType>
100 const Eigen::Vector3i& voxel_coord,
101 const int scale_desired,
102 int& scale_returned);
103
113template<typename OctreeT>
114inline typename std::enable_if_t<OctreeT::DataType::fld_ == se::Field::Occupancy,
115 typename OctreeT::DataType>
116getMinData(const OctreeT& octree, const Eigen::Vector3i& voxel_coord, const int scale_desired);
117
127template<typename OctreeT>
128typename std::enable_if_t<OctreeT::DataType::fld_ == Field::Occupancy, typename OctreeT::DataType>
129getMaxData(const OctreeT& octree, const Eigen::Vector3i& voxel_coord, const int scale_desired);
130
131// TODO: Reduce getField functions for single and multi-res to one
132
134
145template<typename OctreeT>
146std::optional<field_t> getField(const OctreeT& octree, const Eigen::Vector3i& voxel_coord);
147
161template<typename OctreeT, typename BlockT>
162std::optional<field_t>
163getField(const OctreeT& octree, BlockT* block_ptr, const Eigen::Vector3i& voxel_coord);
164
165
166
168
181template<typename OctreeT>
182typename std::enable_if_t<OctreeT::res_ == Res::Multi, std::optional<field_t>>
184 const Eigen::Vector3i& voxel_coord,
185 const int scale_desired,
186 int& scale_returned);
187
203template<typename OctreeT, typename BlockT>
204typename std::enable_if_t<OctreeT::res_ == Res::Multi, std::optional<field_t>>
207 const Eigen::Vector3i& voxel_coord,
208 const int scale_desired,
209 int& scale_returned);
210
211
212
244template<typename OctreeT, typename ValidF, typename GetF>
245typename std::enable_if_t<OctreeT::res_ == Res::Multi,
246 std::optional<std::invoke_result_t<GetF, typename OctreeT::DataType>>>
248 const Eigen::Vector3f& voxel_coord_f,
249 ValidF valid,
250 GetF get,
251 const int desired_scale = 0,
252 int* const returned_scale = nullptr);
253
258template<typename OctreeT, typename ValidF, typename GetF>
259typename std::enable_if_t<OctreeT::res_ == Res::Single,
260 std::optional<std::invoke_result_t<GetF, typename OctreeT::DataType>>>
261getInterp(const OctreeT& octree, const Eigen::Vector3f& voxel_coord_f, ValidF valid, GetF get);
262
263
264
278template<typename OctreeT>
279typename std::enable_if_t<OctreeT::res_ == Res::Multi, std::optional<field_t>>
281 const Eigen::Vector3f& voxel_coord_f,
282 const int desired_scale = 0,
283 int* const returned_scale = nullptr);
284
289template<typename OctreeT>
290typename std::enable_if_t<OctreeT::res_ == Res::Single, std::optional<field_t>>
291getFieldInterp(const OctreeT& octree, const Eigen::Vector3f& voxel_coord_f);
292
306template<typename OctreeT>
307typename std::enable_if_t<OctreeT::res_ == Res::Multi && OctreeT::col_ == Colour::On,
308 std::optional<colour_t>>
310 const Eigen::Vector3f& voxel_coord_f,
311 const int desired_scale = 0,
312 int* const returned_scale = nullptr);
313
318template<typename OctreeT>
319typename std::enable_if_t<OctreeT::res_ == Res::Single && OctreeT::col_ == Colour::On,
320 std::optional<colour_t>>
321getColourInterp(const OctreeT& octree, const Eigen::Vector3f& voxel_coord_f);
322
323
324
326
337template<typename OctreeT>
338typename std::enable_if_t<OctreeT::res_ == Res::Single, std::optional<field_vec_t>>
339getFieldGrad(const OctreeT& octree, const Eigen::Vector3f& voxel_coord_f);
340
341
342
344
355template<typename OctreeT>
356typename std::enable_if_t<OctreeT::res_ == Res::Multi, std::optional<field_vec_t>>
357getFieldGrad(const OctreeT& octree, const Eigen::Vector3f& voxel_coord_f);
358
370template<typename OctreeT>
371typename std::enable_if_t<OctreeT::res_ == Res::Multi, std::optional<field_vec_t>>
372getFieldGrad(const OctreeT& octree, const Eigen::Vector3f& voxel_coord_f, int& scale_returned);
373
386template<typename OctreeT>
387typename std::enable_if_t<OctreeT::res_ == Res::Multi, std::optional<field_vec_t>>
389 const Eigen::Vector3f& voxel_coord_f,
390 const int scale_desired,
391 int& scale_returned);
392
393} // namespace visitor
394} // namespace se
395
396#include "impl/visitor_impl.hpp"
397
398#endif // SE_VISITOR_HPP
Definition image.hpp:19
std::enable_if_t< OctreeT::res_==Res::Multi &&OctreeT::col_==Colour::On, std::optional< colour_t > > getColourInterp(const OctreeT &octree, const Eigen::Vector3f &voxel_coord_f, const int desired_scale=0, int *const returned_scale=nullptr)
Interpolate the colour at the supplied voxel coordinates and desired scale.
std::enable_if_t< OctreeT::res_==Res::Multi, std::optional< std::invoke_result_t< GetF, typename OctreeT::DataType > > > getInterp(const OctreeT &octree, const Eigen::Vector3f &voxel_coord_f, ValidF valid, GetF get, const int desired_scale=0, int *const returned_scale=nullptr)
Interpolate a member of se::Octree::DataType at the supplied voxel coordinates and desired scale.
std::enable_if_t< OctreeT::DataType::fld_==Field::Occupancy, typename OctreeT::DataType > getMaxData(const OctreeT &octree, const Eigen::Vector3i &voxel_coord, const int scale_desired)
Get the max occupancy data at a given scale.
std::enable_if_t< OctreeT::DataType::fld_==se::Field::Occupancy, typename OctreeT::DataType > getMinData(const OctreeT &octree, const Eigen::Vector3i &voxel_coord, const int scale_desired)
Get the min occupancy data at a given scale.
std::enable_if_t< OctreeT::res_==Res::Multi, std::optional< field_t > > getFieldInterp(const OctreeT &octree, const Eigen::Vector3f &voxel_coord_f, const int desired_scale=0, int *const returned_scale=nullptr)
Interpolate the field at the supplied voxel coordinates and desired scale.
OctreeT::DataType getData(const OctreeT &octree, const Eigen::Vector3i &voxel_coord)
Single/multi-res get data functions.
std::enable_if_t< OctreeT::res_==Res::Single, std::optional< field_vec_t > > getFieldGrad(const OctreeT &octree, const Eigen::Vector3f &voxel_coord_f)
Single-res get gradient functions.
std::optional< field_t > getField(const OctreeT &octree, const Eigen::Vector3i &voxel_coord)
Single/Multi-res get field functions.
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14