UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
weight.hpp
1
41#ifndef UFO_CORE_WEIGHT_HPP
42#define UFO_CORE_WEIGHT_HPP
43
44// STL
45#include <format>
46#include <ostream>
47
48namespace ufo
49{
67struct Weight {
71 using value_type = float;
72
77
85 [[nodiscard]] constexpr operator value_type() const noexcept { return weight; }
86
94 [[nodiscard]] friend constexpr auto operator<=>(Weight lhs,
95 Weight rhs) noexcept = default;
96
104 [[nodiscard]] friend constexpr bool operator==(Weight lhs,
105 Weight rhs) noexcept = default;
106};
107
120inline std::ostream& operator<<(std::ostream& out, Weight v) { return out << v.weight; }
121} // namespace ufo
122
123template <>
124struct std::formatter<ufo::Weight> : std::formatter<ufo::Weight::value_type> {
125 auto format(ufo::Weight v, std::format_context& ctx) const
126 {
127 return std::formatter<ufo::Weight::value_type>::format(v.weight, ctx);
128 }
129};
130#endif // UFO_CORE_WEIGHT_HPP
All vision-related classes and functions.
Definition cloud.hpp:49
Represents a generic scalar weight as a single float value.
Definition weight.hpp:67
float value_type
Underlying scalar type.
Definition weight.hpp:71
value_type weight
The raw scalar weight (e.g., a confidence in [0, 1]).
Definition weight.hpp:76
friend constexpr bool operator==(Weight lhs, Weight rhs) noexcept=default
Equality comparison.
friend constexpr auto operator<=>(Weight lhs, Weight rhs) noexcept=default
Three-way comparison (total order on the underlying float).