2026-07-23 07:33:15 +00:00
|
|
|
#pragma once
|
|
|
|
|
#include "vde/core/point.h"
|
|
|
|
|
#include "vde/core/transform.h"
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace vde::core {
|
2026-07-23 08:19:24 +00:00
|
|
|
using foundation::Point2D;
|
|
|
|
|
using foundation::Point3D;
|
|
|
|
|
using foundation::Vector2D;
|
|
|
|
|
using foundation::Vector3D;
|
2026-07-23 07:33:15 +00:00
|
|
|
|
|
|
|
|
struct ICPResult {
|
|
|
|
|
Transform3D transform; // Rigid transform aligning source to target
|
|
|
|
|
double rms_error; // Root-mean-square error
|
|
|
|
|
int iterations; // Number of iterations used
|
|
|
|
|
bool converged;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// Iterative Closest Point (ICP) for rigid point cloud registration
|
|
|
|
|
/// @param source Source point cloud (moved)
|
|
|
|
|
/// @param target Target point cloud (fixed)
|
|
|
|
|
/// @param max_iter Maximum iterations
|
|
|
|
|
/// @param tolerance Convergence tolerance on RMS change
|
|
|
|
|
[[nodiscard]] ICPResult icp_register(const std::vector<Point3D>& source,
|
|
|
|
|
const std::vector<Point3D>& target,
|
|
|
|
|
int max_iter = 50,
|
|
|
|
|
double tolerance = 1e-6);
|
|
|
|
|
|
|
|
|
|
} // namespace vde::core
|