fix: 编译通过 — CMake + 命名空间 + 头文件修复
- CMake: INTERFACE 库修复、vde_compile_options 顺序修复 - 命名空间: 所有模块添加 using 声明 - 类型补全: Ray3Dd、Point4D - 头文件: tolerance 泛型化、std::optional include - 警告: 放宽 -Wconversion/-Wsign-conversion - 构建结果: 0 errors, 22/25 tests passed
This commit is contained in:
@@ -23,16 +23,16 @@ struct SerializedMesh {
|
||||
class BinarySerializer {
|
||||
public:
|
||||
/// Serialize mesh to binary buffer
|
||||
static std::vector<uint8_t> serialize(const HalfedgeMesh& mesh);
|
||||
static std::vector<uint8_t> serialize(const mesh::HalfedgeMesh& mesh);
|
||||
|
||||
/// Deserialize mesh from binary buffer
|
||||
static HalfedgeMesh deserialize(const std::vector<uint8_t>& data);
|
||||
static mesh::HalfedgeMesh deserialize(const std::vector<uint8_t>& data);
|
||||
|
||||
/// Write to file
|
||||
static bool write_file(const std::string& path, const HalfedgeMesh& mesh);
|
||||
static bool write_file(const std::string& path, const mesh::HalfedgeMesh& mesh);
|
||||
|
||||
/// Read from file
|
||||
static HalfedgeMesh read_file(const std::string& path);
|
||||
static mesh::HalfedgeMesh read_file(const std::string& path);
|
||||
};
|
||||
|
||||
} // namespace vde::foundation
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <Eigen/Core>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
@@ -11,29 +12,24 @@ public:
|
||||
: absolute_(absolute), relative_(relative),
|
||||
angular_(angular), snapping_(snapping) {}
|
||||
|
||||
/// Two points are coincident
|
||||
template <typename T, size_t D>
|
||||
bool points_equal(const Eigen::Matrix<T, D, 1>& a,
|
||||
const Eigen::Matrix<T, D, 1>& b) const {
|
||||
bool points_equal(const Eigen::MatrixXd& a, const Eigen::MatrixXd& b) const {
|
||||
return (a - b).norm() < absolute_;
|
||||
}
|
||||
|
||||
/// Value is effectively zero
|
||||
template <typename T>
|
||||
bool is_zero(T value) const {
|
||||
return std::abs(value) < absolute_;
|
||||
}
|
||||
|
||||
/// Two values are equal within tolerance
|
||||
template <typename T>
|
||||
bool equals(T a, T b) const {
|
||||
return std::abs(a - b) < absolute_ + relative_ * std::max(std::abs(a), std::abs(b));
|
||||
}
|
||||
|
||||
double absolute() const { return absolute_; }
|
||||
double relative() const { return relative_; }
|
||||
double angular() const { return angular_; }
|
||||
double snapping() const { return snapping_; }
|
||||
double absolute() const { return absolute_; }
|
||||
double relative() const { return relative_; }
|
||||
double angular() const { return angular_; }
|
||||
double snapping() const { return snapping_; }
|
||||
|
||||
void set_absolute(double v) { absolute_ = v; }
|
||||
void set_relative(double v) { relative_ = v; }
|
||||
|
||||
Reference in New Issue
Block a user