#include "cli_weld.hpp" #include #include #include #include namespace wowee { namespace editor { namespace cli { std::vector buildWeldMap( const std::vector& positions, float eps, std::size_t& uniqueOut) { const float invEps = 1.0f / std::max(eps, 1e-9f); using QKey = std::tuple; std::map bucket; std::vector canon(positions.size()); for (std::size_t v = 0; v < positions.size(); ++v) { const auto& p = positions[v]; QKey k{static_cast(std::lround(p.x * invEps)), static_cast(std::lround(p.y * invEps)), static_cast(std::lround(p.z * invEps))}; auto it = bucket.find(k); if (it == bucket.end()) { bucket.emplace(k, static_cast(v)); canon[v] = static_cast(v); } else { canon[v] = it->second; } } uniqueOut = bucket.size(); return canon; } } // namespace cli } // namespace editor } // namespace wowee