RSMesh 1.0.0
一个曲面重构的系统,输入为点云,输出为obj,stl等主流格式的网格文件,使用的方法为径向基函数插值,采取了并行优化、Intel-MKL等优化措施,支持百万级别的点云
载入中...
搜索中...
未找到
closed_normals.h
1//
2// Created by RainSure on 2024/2/19.
3//
4
5#ifndef RSMESH_CLOSED_NORMALS_H
6#define RSMESH_CLOSED_NORMALS_H
7
8#include "types.h"
9#include "table.h"
10#include "geometry/point3d.h"
11#include "point_cloud/normal_estimator.h"
12#include "common/eigen_utility.h"
13#include <string>
14#include <vector>
15#include <exception>
16#include <iostream>
17
22namespace rsmesh::examples {
24 std::string input;
25 std::string output;
26 std::vector<index_t> knn_number_normals = {10, 30, 100, 300};
27 index_t knn_number_orientations = 20;
28 double min_plane_factor = 1.8;
29 };
30 void generate_closed_normals(
31 const ClosedNormalsParameters& parameters
32 ) {
33 try {
34 const std::string& input = parameters.input;
35 const std::string& output = parameters.output;
36 const std::vector<index_t>& knn_number_normals = parameters.knn_number_normals;
37 const index_t knn_number_orientations = parameters.knn_number_orientations;
38 const double min_plane_factor = parameters.min_plane_factor;
39 // read points x, y, z
40 tabled table = read_table(input);
41 geometry::points3d points = table(Eigen::all, {0, 1, 2});
42
43 // get normals
45 estimate_with_knn(knn_number_normals, min_plane_factor).
46 orient_closed_surface(knn_number_orientations);
47
48 // output points with normals
49 write_table(output, common::concatenate_cols(points, normals));
50 } catch(const std::exception& e) {
51 std::cerr << e.what() << std::endl;
52 exit(1);
53 }
54 }
55} // namespace rsmesh::examples
56
57#endif //RSMESH_CLOSED_NORMALS_H
examples命名空间,包含一些使用RSMesh库的示例
Eigen::Matrix< double, Eigen::Dynamic, 3, Eigen::RowMajor > vectors3d
3维向量的集合
Definition point3d.h:44
vectors3d points3d
3维点的集合
Definition point3d.h:48