|
Thunderbots Project
|
#include <cubic_bezier_spline2d.h>


Public Member Functions | |
| CubicBezierSpline2d (const Point &start_point, const Vector &start_vector, const Point &end_point, const Vector &end_vector, const std::vector< Point > &intermediate_knots) | |
| const Point | getValueAt (double t) const override |
| const std::vector< Point > | getKnots () const override |
| size_t | getNumKnots () const override |
| std::vector< double > | getKnotParametrizationValues () const override |
| const Point | getStartPoint () const override |
| const Point | getEndPoint () const override |
| const std::vector< SplineSegment2d > | getSplineSegments () const override |
| const std::vector< Point > & | getControlPoints () const |
| size_t | getNumSegments () const |
Additional Inherited Members | |
Static Protected Member Functions inherited from Spline2d | |
| static SplineSegment2d | createSplineSegment2d (double start_val, double end_val, Polynomial2d polynomial) |
A Cubic Bezier spline is a C2 continuous spline that is formed by a series of bezier curves.
Some useful resources: https://www.ibiblio.org/e-notes/Splines/Intro.htm https://www.ibiblio.org/e-notes/Splines/b-int.html
|
explicit |
Create a CubicBezierSpline2d that:
start and is tangent to start_vector at the startends at end and is tangent to end_vector at the end
** EXAMPLE: **
XXXXXXXXX
start_vector XXXXX XXXXX end_vector
^ XXX XXX ^
| XX XX |
| XX XX |
| XX XX |
| X X |
| XX XX |
| X X |
| X X |
|XX XX|
|X X|
|X X|
|X X|
start + + end
| start_point | The first point on the spline |
| start_vector | The tangent vector at the start of the spline |
| end_point | The last point on the spline |
| end_vector | The tangent vector at the end of the spline. NOTE: this points back along the body of the spline, instead of "off the end" of the spline. ie. this vector is "symmetric" with start_vector |
| intermediate_knots | The intermediate points between start_point and end_point that this spline will pass through |
The direction of the start and end vectors determine the direction of the curve at the start and end points. The magnitude of these vectors determine how far the curve is stretched in the direction of the vector before connecting with the intermediate points
| const std::vector< Point > & getControlPoints | ( | ) | const |
Get the control points that are the implicit representation of the bezier curves that form this spline.
|
overridevirtual |
|
overridevirtual |
Get the parametrization values corresponding to the knots of this spline
So for example, if we had a 3-knot spline that is linearly interpolated, this function would return {0, 0.5, 1}.
NOTE: There is no guarantee that the knots will be at linearly interpolated (equally spaced) intervals. This could return {0, 0.25, 1.0} and still be well defined.
Implements Spline2d.
|
overridevirtual |
Get the knots of this spline, including the start and end points
Implements Spline2d.
|
overridevirtual |
Gets the number of knots in the spline including start and end points
Implements Spline2d.
| size_t getNumSegments | ( | ) | const |
Get the number of segments on this spline.
|
overridevirtual |
Get the segments that make up this spline.
Implements Spline2d.
|
overridevirtual |
|
overridevirtual |
Calculates the value of spline evaluated at value t
| t | A value in [0,1] to get the value of the spline at. 0 is one endpoint of the spline 1 is the other endpoint of the spline |
Implements Spline2d.