RSMesh 1.0.0
一个曲面重构的系统,输入为点云,输出为obj,stl等主流格式的网格文件,使用的方法为径向基函数插值,采取了并行优化、Intel-MKL等优化措施,支持百万级别的点云
载入中...
搜索中...
未找到
rbf_symmetric_evaluator.h
1//
2// Created by RainSure on 2024/2/14.
3//
4
5#ifndef RSMESH_RBF_SYMMETRIC_EVALUATOR_H
6#define RSMESH_RBF_SYMMETRIC_EVALUATOR_H
7
8#include "Eigen/Core"
9#include "common/macros.h"
10#include "fmm/fmm_symmetric_evaluator.h"
11#include "fmm/fmm_tree_height.h"
12#include "geometry/bbox3d.h"
13#include "geometry/point3d.h"
14#include "model.h"
15#include "polynomial/monomial_basis.h"
16#include "polynomial/polynomial_evaluator.h"
17#include "types.h"
18
19namespace rsmesh::interpolation {
20 template <int Order = 10>
23
24 public:
26 : n_points_(points.rows()), n_poly_basis_(model.poly_basis_size()) {
27 auto bbox = geometry::bbox3d::from_points(points);
28 a_ = std::make_unique<fmm::fmm_symmetric_evaluator<Order>>(
29 model, fmm::fmm_tree_height(n_points_), bbox);
30 a_->set_points(points);
31
32 if (n_poly_basis_ > 0) {
33 p_ = std::make_unique<PolynomialEvaluator>(model.poly_dimension(), model.poly_degree());
34 p_->set_field_points(points);
35 }
36 }
37
38 [[nodiscard]] valuesd evaluate() const {
39 auto y = a_->evaluate();
40
41 if (n_poly_basis_ > 0) {
42 // Add polynomial terms.
43 y += p_->evaluate();
44 }
45
46 return y;
47 }
48
49 template <class Derived>
50 void set_weights(const Eigen::MatrixBase<Derived>& weights) {
51 RSMESH_ASSERT(weights.rows() == n_points_ + n_poly_basis_);
52
53 a_->set_weights(weights.head(n_points_));
54
55 if (n_poly_basis_ > 0) {
56 p_->set_weights(weights.tail(n_poly_basis_));
57 }
58 }
59
60 private:
61 const index_t n_points_;
62 const index_t n_poly_basis_;
63
64 std::unique_ptr<fmm::fmm_symmetric_evaluator<Order>> a_;
65 std::unique_ptr<PolynomialEvaluator> p_;
66 };
67} // namespace rsmesh::interpolation
68
69#endif //RSMESH_RBF_SYMMETRIC_EVALUATOR_H
描述了一个插值模型
Definition model.h:21
vectors3d points3d
3维点的集合
Definition point3d.h:48
该命名空间下主要定义了插值相关的类和函数