Thunderbots Project
Loading...
Searching...
No Matches
bezier_curve2d.h
1#pragma once
2
3#include <vector>
4
5#include "software/geom/point.h"
6#include "software/geom/spline2d.h"
7
19{
20 public:
21 BezierCurve2d() = delete;
22
30 explicit BezierCurve2d(std::vector<Point> control_points);
31
42 const Point getValueAt(double t) const;
43
52
58 bool operator==(const BezierCurve2d& other) const;
59
60 private:
61 /*
62 * Evaluate the point `t` on the bezier curve with control points `points`
63 *
64 * Implementation of the De Casteljau algorithm:
65 * https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm
66 * Assumes the curve is parameterized such that `t=0` is the first point, and
67 * `t=1` is the last point.
68 *
69 * @param points The control points of the bezier curve
70 * @param t The value at which to evaluate the bezier curve
71 *
72 * @throw std::invalid_arguments If `points` is empty
73 *
74 * @return The point on the bezier curve corresponding to the value `t`
75 */
76 static const Point deCasteljauAlgorithm(const std::vector<Point>& points,
77 const double t);
78
87 const Vector computePolynomialCoefficients(const size_t order_of_coefficients) const;
88
89 // The control points for this bezier curve
90 const std::vector<Point> control_points;
91};
Definition bezier_curve2d.h:19
const Point getValueAt(double t) const
Definition bezier_curve2d.cpp:15
bool operator==(const BezierCurve2d &other) const
Polynomial2d getPolynomial() const
Definition bezier_curve2d.cpp:21
Definition point.h:14
Definition polynomial2d.h:10
Definition vector.h:12