Fawkes API
Fawkes Development Version
|
A spline made up of cubic Bezier curves. More...
#include <>>
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. | |
![]() | |
Transformable () | |
Constructor. | |
virtual | ~Transformable () |
Destructor. |
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. | |
![]() | |
void | transform (const HomTransform &t) |
Apply the transform to all registered primitives and call the post_transform() method. | |
void | add_primitive (HomCoord *c) |
Add a primitive to the list of primitives that is transformed. | |
void | clear_primitives () |
Clear the list of primitives. |
Friends | |
class | fawkes::SplineDrawer |
fawkes::Spline::Spline | ( | ) |
Constructor.
Definition at line 38 of file spline.cpp.
fawkes::Spline::Spline | ( | const std::vector< HomPoint > & | control_points | ) |
Constructor.
control_points | the control points of the spline |
Definition at line 46 of file spline.cpp.
References register_primitives().
|
virtual |
Destructor.
Definition at line 56 of file spline.cpp.
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.
num_subdivisions | the number of subdivision that shall be performed. |
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.
bezier_index | the index of the curve |
t | a value between 0.0 and 1.0 |
Definition at line 111 of file spline.cpp.
const vector< Bezier > & fawkes::Spline::get_bezier_curves | ( | ) | const |
Get the Bezier curves.
Definition at line 100 of file spline.cpp.
const vector< HomPoint > & fawkes::Spline::get_control_points | ( | ) | const |
Get the control points.
Definition at line 91 of file spline.cpp.
|
protectedvirtual |
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.
|
protectedvirtual |
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.
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.
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 | bezier_index, |
float | t | ||
) |
Compute the tangent vector at position t of the i-th Bezier curve.
bezier_index | the index of the Bezier patch |
t | the curve parameter t |
Definition at line 122 of file spline.cpp.
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.
point_index | index of the approximation point |
Definition at line 134 of file spline.cpp.