ViewDesignEngine  3.1.0
高性能 CAD 计算几何引擎
bezier_curve.h
浏览该文件的文档.
1 #pragma once
2 #include "vde/core/point.h"
3 #include <vector>
4 
5 namespace vde::curves {
6 using core::Point3D;
7 using core::Vector3D;
8 
18 class BezierCurve {
19 public:
28  explicit BezierCurve(std::vector<Point3D> control_points);
29 
36  [[nodiscard]] Point3D evaluate(double t) const;
37 
46  [[nodiscard]] Vector3D derivative(double t, int order = 1) const;
47 
52  [[nodiscard]] int degree() const { return static_cast<int>(cp_.size()) - 1; }
53 
58  [[nodiscard]] std::pair<double, double> domain() const { return {0.0, 1.0}; }
59 
64  [[nodiscard]] const std::vector<Point3D>& control_points() const { return cp_; }
65 
77  [[nodiscard]] std::pair<BezierCurve, BezierCurve> split(double t) const;
78 
87  [[nodiscard]] BezierCurve degree_elevate(int times = 1) const;
88 
89 private:
90  std::vector<Point3D> cp_;
91 };
92 
93 } // namespace vde::curves
任意阶 Bézier 曲线
Definition: bezier_curve.h:18
int degree() const
曲线阶次
Definition: bezier_curve.h:52
BezierCurve degree_elevate(int times=1) const
升阶操作
const std::vector< Point3D > & control_points() const
控制点访问
Definition: bezier_curve.h:64
std::pair< double, double > domain() const
参数定义域
Definition: bezier_curve.h:58
Point3D evaluate(double t) const
在参数 t 处求值曲线点
BezierCurve(std::vector< Point3D > control_points)
构造 Bézier 曲线
Vector3D derivative(double t, int order=1) const
在参数 t 处求导数
std::pair< BezierCurve, BezierCurve > split(double t) const
在 t 处将曲线一分为二
foundation::Vector3D Vector3D
双精度三维向量(重新导出)
Definition: point.h:49
foundation::Point3D Point3D
双精度三维点(重新导出)
Definition: point.h:31