ViewDesignEngine  3.1.0
高性能 CAD 计算几何引擎
nurbs_curve.h
浏览该文件的文档.
1 #pragma once
2 #include "vde/core/point.h"
4 #include <vector>
5 
6 namespace vde::curves {
7 using core::Point3D;
8 using core::Vector3D;
9 
26 class NurbsCurve {
27 public:
41  NurbsCurve(std::vector<Point3D> control_points, std::vector<double> knots,
42  std::vector<double> weights, int degree);
43 
50  [[nodiscard]] Point3D evaluate(double t) const;
51 
61  [[nodiscard]] Vector3D derivative(double t, int order = 1) const;
62 
67  [[nodiscard]] int degree() const { return degree_; }
68 
73  [[nodiscard]] std::pair<double, double> domain() const;
74 
79  [[nodiscard]] const std::vector<Point3D>& control_points() const { return cp_; }
80 
85  [[nodiscard]] const std::vector<double>& weights() const { return weights_; }
86 
91  [[nodiscard]] const std::vector<double>& knots() const { return knots_; }
92 
93 private:
94  std::vector<Point3D> cp_;
95  std::vector<double> knots_;
96  std::vector<double> weights_;
97  int degree_;
98 };
99 
100 } // namespace vde::curves
NURBS 曲线(Non-Uniform Rational B-Spline)
Definition: nurbs_curve.h:26
std::pair< double, double > domain() const
参数定义域
const std::vector< Point3D > & control_points() const
控制点访问
Definition: nurbs_curve.h:79
Point3D evaluate(double t) const
在参数 t 处求值
Vector3D derivative(double t, int order=1) const
在参数 t 处求导数
const std::vector< double > & knots() const
节点向量访问
Definition: nurbs_curve.h:91
NurbsCurve(std::vector< Point3D > control_points, std::vector< double > knots, std::vector< double > weights, int degree)
构造 NURBS 曲线
int degree() const
曲线阶次
Definition: nurbs_curve.h:67
const std::vector< double > & weights() const
权重访问
Definition: nurbs_curve.h:85
foundation::Vector3D Vector3D
双精度三维向量(重新导出)
Definition: point.h:49
foundation::Point3D Point3D
双精度三维点(重新导出)
Definition: point.h:31