RSMesh 1.0.0
一个曲面重构的系统,输入为点云,输出为obj,stl等主流格式的网格文件,使用的方法为径向基函数插值,采取了并行优化、Intel-MKL等优化措施,支持百万级别的点云
载入中...
搜索中...
未找到
bit.h
1//
2// Created by RainSure on 2024/2/23.
3//
4
5#ifndef RSMESH_BIT_H
6#define RSMESH_BIT_H
7
8#include <bit>
9
14namespace rsmesh::isosurface {
15 template <class T>
16 int bit_count(T bit_set) {
17 return std::popcount(bit_set);
18 }
19
20 template <class T>
21 int bit_peek(T bit_set) {
22 if (bit_set == 0) {
23 return -1;
24 }
25
26 return std::countr_zero(bit_set);
27 }
28
29 template <class T>
30 int bit_pop(T* bit_set) {
31 if (*bit_set == 0) {
32 return -1;
33 }
34
35 auto bit_index = bit_peek(*bit_set);
36 auto bit = T{1} << bit_index;
37 *bit_set ^= bit;
38
39 return bit_index;
40 }
41}
42
43#endif //RSMESH_BIT_H
该命名空间下主要定义了等值面提取相关的类和函数