RSMesh
1.0.0
一个曲面重构的系统,输入为点云,输出为obj,stl等主流格式的网格文件,使用的方法为径向基函数插值,采取了并行优化、Intel-MKL等优化措施,支持百万级别的点云
载入中...
搜索中...
未找到
include
numeric
sum_accumulator.h
1
//
2
// Created by RainSure on 2024/1/14.
3
//
4
5
#ifndef RSMESH_SUM_ACCUMULATOR_H
6
#define RSMESH_SUM_ACCUMULATOR_H
7
8
#include <cstddef>
9
#include <type_traits>
10
11
namespace
rsmesh::numeric
{
12
template<class Floating, typename std::enable_if<std::is_floating_point<Floating>::value, std::nullptr_t>::type =
nullptr
>
13
class
sum_accumulator
{
14
public
:
15
sum_accumulator
() : sum_(), correction_() {}
16
Floating get()
const
{
return
sum_;}
17
sum_accumulator
& operator+=(Floating f) {
18
auto
summand = f + correction_;
19
auto
next_sum = sum_ + summand;
20
correction_ = summand - (next_sum - sum_);
21
sum_ = next_sum;
22
return
*
this
;
23
}
24
private
:
25
Floating sum_;
26
Floating correction_;
27
};
28
}
// namespace rsmesh::numeric
29
30
#endif
//RSMESH_SUM_ACCUMULATOR_H
rsmesh::numeric::sum_accumulator
Definition
sum_accumulator.h:13
rsmesh::numeric
该命名空间下主要定义了数值计算相关的类和函数
制作者
1.10.0