64ad721ed7
- CMake: INTERFACE 库修复、vde_compile_options 顺序修复 - 命名空间: 所有模块添加 using 声明 - 类型补全: Ray3Dd、Point4D - 头文件: tolerance 泛型化、std::optional include - 警告: 放宽 -Wconversion/-Wsign-conversion - 构建结果: 0 errors, 22/25 tests passed
27 lines
829 B
C++
27 lines
829 B
C++
#pragma once
|
|
#include "vde/core/point.h"
|
|
#include <vector>
|
|
|
|
namespace vde::curves {
|
|
using core::Point3D;
|
|
using core::Vector3D;
|
|
|
|
class BezierSurface {
|
|
public:
|
|
BezierSurface(std::vector<std::vector<Point3D>> control_grid);
|
|
|
|
[[nodiscard]] Point3D evaluate(double u, double v) const;
|
|
[[nodiscard]] Vector3D derivative_u(double u, double v) const;
|
|
[[nodiscard]] Vector3D derivative_v(double u, double v) const;
|
|
[[nodiscard]] Vector3D normal(double u, double v) const;
|
|
|
|
[[nodiscard]] int degree_u() const { return static_cast<int>(cp_.size()) - 1; }
|
|
[[nodiscard]] int degree_v() const { return static_cast<int>(cp_[0].size()) - 1; }
|
|
|
|
private:
|
|
std::vector<std::vector<Point3D>> cp_;
|
|
[[nodiscard]] Point3D de_casteljau(double t, const std::vector<Point3D>& pts) const;
|
|
};
|
|
|
|
} // namespace vde::curves
|