64ad721ed7
- CMake: INTERFACE 库修复、vde_compile_options 顺序修复 - 命名空间: 所有模块添加 using 声明 - 类型补全: Ray3Dd、Point4D - 头文件: tolerance 泛型化、std::optional include - 警告: 放宽 -Wconversion/-Wsign-conversion - 构建结果: 0 errors, 22/25 tests passed
31 lines
969 B
C++
31 lines
969 B
C++
#pragma once
|
|
#include "vde/core/point.h"
|
|
#include "vde/curves/bspline_curve.h"
|
|
#include <vector>
|
|
|
|
namespace vde::curves {
|
|
using core::Point3D;
|
|
using core::Vector3D;
|
|
|
|
class NurbsCurve {
|
|
public:
|
|
NurbsCurve(std::vector<Point3D> control_points, std::vector<double> knots,
|
|
std::vector<double> weights, int degree);
|
|
|
|
[[nodiscard]] Point3D evaluate(double t) const;
|
|
[[nodiscard]] Vector3D derivative(double t, int order = 1) const;
|
|
[[nodiscard]] int degree() const { return degree_; }
|
|
[[nodiscard]] std::pair<double, double> domain() const;
|
|
[[nodiscard]] const std::vector<Point3D>& control_points() const { return cp_; }
|
|
[[nodiscard]] const std::vector<double>& weights() const { return weights_; }
|
|
[[nodiscard]] const std::vector<double>& knots() const { return knots_; }
|
|
|
|
private:
|
|
std::vector<Point3D> cp_;
|
|
std::vector<double> knots_;
|
|
std::vector<double> weights_;
|
|
int degree_;
|
|
};
|
|
|
|
} // namespace vde::curves
|