fawkes::Spline Class Reference
A spline made up of cubic Bezier curves. More...
#include <geometry/spline.h>

Public Member Functions | |
| Spline () | |
| Constructor. | |
| Spline (const std::vector< HomPoint > &control_points) | |
| Constructor. | |
| virtual | ~Spline () |
| Destructor. | |
| void | set_control_points (const std::vector< HomPoint > &control_points) |
| Set the control points. | |
| void | set_control_point (unsigned int i, const HomPoint &p) |
| Set a specific control point. | |
| const std::vector< HomPoint > & | get_control_points () const |
| Get the control points. | |
| const std::vector< Bezier > & | get_bezier_curves () const |
| Get the Bezier curves. | |
| HomPoint | eval (unsigned int bezier_index, float t) |
| Get a point on the curve for a specified segment and value t. | |
| HomVector | tangent (unsigned int bezier_index, float t) |
| Compute the tangent vector at position t of the i-th Bezier curve. | |
| HomVector | tangent (unsigned int point_index) |
| Compute the tangent vector at the specified approximation point. | |
| std::vector< HomPoint > | approximate (unsigned int num_subdivisions=4) |
| Get linear approximation of the curve. | |
Protected Member Functions | |
| virtual void | register_primitives () |
| Here, a derived class should register its primitives (HomPoints and HomVectors) by calling add_primitive for each of those. | |
| virtual void | post_transform () |
| This method is called after the primitives are transformed. | |
Friends | |
| class | fawkes::SplineDrawer |
Detailed Description
A spline made up of cubic Bezier curves.
Definition at line 36 of file spline.h.
Constructor & Destructor Documentation
| fawkes::Spline::Spline | ( | ) |
| fawkes::Spline::Spline | ( | const std::vector< HomPoint > & | control_points | ) |
Constructor.
- Parameters:
-
control_points the control points of the spline
Definition at line 46 of file spline.cpp.
References register_primitives().
| fawkes::Spline::~Spline | ( | ) | [virtual] |
Member Function Documentation
| vector< HomPoint > fawkes::Spline::approximate | ( | unsigned int | num_subdivisions = 4 |
) |
Get linear approximation of the curve.
Instead of evaluating the Bezier polynoms at constant intervals the Bezier curves are subdivided and the control points are taken as an approximation. This is more efficient and yields better results. The control points converge to the curve quadratically in the number of subdivisions.
- Parameters:
-
num_subdivisions the number of subdivision that shall be performed.
- Returns:
- points approximating the curve
Definition at line 161 of file spline.cpp.
| HomPoint fawkes::Spline::eval | ( | unsigned int | bezier_index, | |
| float | t | |||
| ) |
Get a point on the curve for a specified segment and value t.
- Parameters:
-
bezier_index the index of the curve t a value between 0.0 and 1.0
- Returns:
- a point on the i-th curve for the parameter t
Definition at line 111 of file spline.cpp.
| const vector< Bezier > & fawkes::Spline::get_bezier_curves | ( | ) | const |
Get the Bezier curves.
- Returns:
- const reference to the current Bezier curves
Definition at line 100 of file spline.cpp.
| const vector< HomPoint > & fawkes::Spline::get_control_points | ( | ) | const |
Get the control points.
- Returns:
- const reference to the current control points
Definition at line 91 of file spline.cpp.
| void fawkes::Spline::post_transform | ( | ) | [protected, virtual] |
This method is called after the primitives are transformed.
Any additional updates that need to be done should be done here.
Implements fawkes::Transformable.
Definition at line 204 of file spline.cpp.
| void fawkes::Spline::register_primitives | ( | ) | [protected, virtual] |
Here, a derived class should register its primitives (HomPoints and HomVectors) by calling add_primitive for each of those.
Implements fawkes::Transformable.
Definition at line 191 of file spline.cpp.
References fawkes::Transformable::add_primitive().
Referenced by set_control_point(), set_control_points(), and Spline().
| void fawkes::Spline::set_control_point | ( | unsigned int | i, | |
| const HomPoint & | point | |||
| ) |
Set a specific control point.
- Parameters:
-
i the index of the control point point the replacement control point
Definition at line 78 of file spline.cpp.
References fawkes::Transformable::clear_primitives(), and register_primitives().
| void fawkes::Spline::set_control_points | ( | const std::vector< HomPoint > & | control_points | ) |
Set the control points.
- Parameters:
-
control_points the new control points
Definition at line 64 of file spline.cpp.
References fawkes::Transformable::clear_primitives(), and register_primitives().
| HomVector fawkes::Spline::tangent | ( | unsigned int | point_index | ) |
Compute the tangent vector at the specified approximation point.
The range of the index is determined by number of subidivisions that have been performed during the last approximation.
- Parameters:
-
point_index index of the approximation point
- Returns:
- tangent vector
Definition at line 134 of file spline.cpp.
| HomVector fawkes::Spline::tangent | ( | unsigned int | bezier_index, | |
| float | t | |||
| ) |
Compute the tangent vector at position t of the i-th Bezier curve.
- Parameters:
-
bezier_index the index of the Bezier patch t the curve parameter t
- Returns:
- the tangent vector
Definition at line 122 of file spline.cpp.
The documentation for this class was generated from the following files:
- src/libs/geometry/spline.h
- src/libs/geometry/spline.cpp

