RSMesh 1.0.0
一个曲面重构的系统,输入为点云,输出为obj,stl等主流格式的网格文件,使用的方法为径向基函数插值,采取了并行优化、Intel-MKL等优化措施,支持百万级别的点云
载入中...
搜索中...
未找到
polynomial_basic_base.h
1//
2// Created by RainSure on 2024/1/21.
3//
4
5#ifndef RSMESH_POLYNOMIAL_BASIC_BASE_H
6#define RSMESH_POLYNOMIAL_BASIC_BASE_H
7
8#include "common/macros.h"
9#include "types.h"
10
11namespace rsmesh::polynomial {
13 public:
14 explicit polynomial_basis_base(int dimension, int degree) : dimension_(dimension), degree_(degree) {
15 RSMESH_ASSERT(dimension >= 1 and dimension <= 3);
16 RSMESH_ASSERT(degree >= 0);
17 }
18
19 virtual ~polynomial_basis_base() = default;
22
23 polynomial_basis_base& operator=(const polynomial_basis_base&) = delete;
24 polynomial_basis_base& operator=(polynomial_basis_base&&) = delete;
25
26 [[nodiscard]] int dimension() const {return dimension_;}
27 [[nodiscard]] int degree() const {return degree_;}
28
29 [[nodiscard]] index_t basis_size() const {return basis_size(dimension_, degree_);}
30
31 static index_t basis_size(int dimension, int degree) {
32 if(degree < 0) {
33 return 0;
34 }
35
36 RSMESH_ASSERT(dimension >= 1 and dimension <= 3);
37 auto k = index_t{degree} + 1;
38 switch(dimension) {
39 case 1:
40 return k;
41 case 2:
42 return k * (k + 1) / 2;
43 case 3:
44 return k * (k + 1) * (k + 2) / 6;
45 default:
46 RSMESH_UNREACHABLE();
47 break;
48 }
49
50 return 0;
51 }
52
53 private:
54 const int dimension_;
55 const int degree_;
56 };
57}
58
59#endif //RSMESH_POLYNOMIAL_BASIC_BASE_H
该命名空间下主要定义了多项式计算相关的类和函数