UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
block.hpp
1
41#ifndef UFO_MAP_COST_BLOCK_HPP
42#define UFO_MAP_COST_BLOCK_HPP
43
44// UFO
45#include <ufo/utility/create_array.hpp>
46
47// STL
48#include <array>
49#include <cassert>
50#include <cstddef>
51
52namespace ufo
53{
55 using cost_t = float;
56
57 cost_t cost{};
58
59 CostElement() noexcept = default;
60 CostElement(CostElement const&) noexcept = default;
61
62 CostElement(float cost) noexcept : cost(cost) {}
63
64 CostElement& operator=(CostElement const&) noexcept = default;
65};
66
67template <std::size_t BF>
68struct CostBlock {
69 using cost_t = CostElement::cost_t;
70
71 std::array<CostElement, BF> data;
72
73 constexpr CostBlock() = default;
74
75 constexpr CostBlock(float cost) : data(createArray<BF>(CostElement(cost))) {}
76
77 constexpr CostBlock(CostElement const& parent) : data(createArray<BF>(parent)) {}
78
79 constexpr void fill(CostElement const& parent) { data.fill(parent); }
80
81 [[nodiscard]] constexpr CostElement& operator[](std::size_t pos)
82 {
83 assert(BF > pos);
84 return data[pos];
85 }
86
87 [[nodiscard]] constexpr CostElement const& operator[](std::size_t pos) const
88 {
89 assert(BF > pos);
90 return data[pos];
91 }
92};
93} // namespace ufo
94#endif // UFO_MAP_COST_BLOCK_HPP
All vision-related classes and functions.
Definition cloud.hpp:49