Thunderbots Project
Loading...
Searching...
No Matches
LinearSpline2d Class Reference

#include <linear_spline2d.h>

Inheritance diagram for LinearSpline2d:
Collaboration diagram for LinearSpline2d:

Public Member Functions

 LinearSpline2d (const std::vector< Point > &points)
 
 LinearSpline2d (const std::initializer_list< Point > &points)
 
const Point getValueAt (double val) const override
 
size_t getNumKnots (void) const override
 
std::vector< double > getKnotParametrizationValues () const override
 
const std::vector< PointgetKnots (void) const override
 
const Point getStartPoint (void) const override
 
const Point getEndPoint (void) const override
 
const std::vector< SplineSegment2dgetSplineSegments () const override
 

Detailed Description

A linear spline is a spline composed of a series of linear 2d polynomials, ie. a series of connected line segments

Constructor & Destructor Documentation

◆ LinearSpline2d() [1/2]

LinearSpline2d ( const std::vector< Point > &  points)
explicit

Construct a spline by drawing line segments between consecutive Points

Exceptions
std::invalid_argumentif points.size() == 0
Parameters
pointsPoints on the spline

◆ LinearSpline2d() [2/2]

LinearSpline2d ( const std::initializer_list< Point > &  points)

Construct a spline by drawing line segments between consecutive Points

Exceptions
std::invalid_argumentif points.size() == 0
Parameters
pointsPoints on the spline

Member Function Documentation

◆ getEndPoint()

const Point getEndPoint ( void  ) const
overridevirtual

Gets end point of spline

Returns
end point of spline

Implements Spline2d.

◆ getKnotParametrizationValues()

std::vector< double > getKnotParametrizationValues ( ) const
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.

Returns
The parametrization values corresponding to the knots of this spline

Implements Spline2d.

◆ getKnots()

const std::vector< Point > getKnots ( void  ) const
overridevirtual

Get the knots of this spline, including the start and end points

Returns
The knots of this spline, including the start and end points

Implements Spline2d.

◆ getNumKnots()

size_t getNumKnots ( void  ) const
overridevirtual

Gets the number of knots in the spline including start and end points

Returns
The number of knots in the spline including start and end points

Implements Spline2d.

◆ getSplineSegments()

const std::vector< SplineSegment2d > getSplineSegments ( ) const
overridevirtual

Get the segments that make up this spline.

Returns
The segments that make up this spline, with the order of segments being the order in which they appear along the spline, going from start to end.

Implements Spline2d.

◆ getStartPoint()

const Point getStartPoint ( void  ) const
overridevirtual

Gets start point of spline

Returns
start point of spline

Implements Spline2d.

◆ getValueAt()

const Point getValueAt ( double  t) const
overridevirtual

Calculates the value of spline evaluated at value t

Parameters
tA 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
Returns
Value of spline evaluated at t. If t not in [0,1], then the closest endpoint

Implements Spline2d.


The documentation for this class was generated from the following files: