fawkes::Bezier Class Reference
A Bezier curve class. More...
#include <geometry/bezier.h>

Public Member Functions | |
| Bezier () | |
| Constructor. | |
| Bezier (const std::vector< HomPoint > &control_points) | |
| Constructor. | |
| Bezier (const Bezier &b) | |
| Copy constructor. | |
| ~Bezier () | |
| Destructor. | |
| void | set_control_points (const std::vector< HomPoint > &control_points) |
| Set the control points. | |
| void | set_control_point (unsigned int index, const HomPoint &control_point) |
| Replace a specific control point. | |
| std::vector< HomPoint > | get_control_points () const |
| Get the control points. | |
| HomPoint | get_control_point (unsigned int i) const |
| Get a specific control point. | |
| unsigned int | degree () const |
| Get the degree of the polynom. | |
| HomPoint | eval (float t) |
| Evalutate the polynom for a given t. | |
| HomVector | tangent_at_t (float t) |
| Compute the tangent vector at position t. | |
| HomVector | tangent_at_point (unsigned int index) |
| Compute the tangent vector at the specified control point. | |
| void | subdivide (float t, Bezier &c, Bezier &d) |
| Subdivide the curve into two polynome of the same degree. | |
| const std::vector< HomPoint > & | approximate (unsigned int num_subdivisions=4) |
| Approximate the curve with points. | |
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. | |
Detailed Description
A Bezier curve class.
Definition at line 34 of file bezier.h.
Constructor & Destructor Documentation
| fawkes::Bezier::Bezier | ( | ) |
| fawkes::Bezier::Bezier | ( | const std::vector< HomPoint > & | control_points | ) |
Constructor.
- Parameters:
-
control_points the control points for the Bezier curve
Definition at line 50 of file bezier.cpp.
References register_primitives().
| fawkes::Bezier::Bezier | ( | const Bezier & | b | ) |
Copy constructor.
- Parameters:
-
b another Bezier curve
Definition at line 67 of file bezier.cpp.
References fawkes::Transformable::clear_primitives(), and register_primitives().
| fawkes::Bezier::~Bezier | ( | ) |
Member Function Documentation
| const vector< HomPoint > & fawkes::Bezier::approximate | ( | unsigned int | num_subdivisions = 4 |
) |
Approximate the curve with points.
- Parameters:
-
num_subdivisions the number of subdivisions that is performed
- Returns:
- the point approximating the curve
Definition at line 252 of file bezier.cpp.
Referenced by fawkes::BezierDrawer::draw().
| unsigned int fawkes::Bezier::degree | ( | ) | const |
Get the degree of the polynom.
- Returns:
- the degree of the polynom
Definition at line 166 of file bezier.cpp.
| HomPoint fawkes::Bezier::eval | ( | float | t | ) |
Evalutate the polynom for a given t.
- Parameters:
-
t a value between 0.0 and 1.0
- Returns:
- the corresponding point on the curve
Definition at line 176 of file bezier.cpp.
| HomPoint fawkes::Bezier::get_control_point | ( | unsigned int | i | ) | const |
Get a specific control point.
- Parameters:
-
i the index of the control point
Definition at line 154 of file bezier.cpp.
| std::vector< HomPoint > fawkes::Bezier::get_control_points | ( | ) | const |
Get the control points.
- Returns:
- a copy of the control points
Definition at line 145 of file bezier.cpp.
| void fawkes::Bezier::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 366 of file bezier.cpp.
| void fawkes::Bezier::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 353 of file bezier.cpp.
References fawkes::Transformable::add_primitive().
Referenced by Bezier(), set_control_point(), and set_control_points().
| void fawkes::Bezier::set_control_point | ( | unsigned int | index, | |
| const HomPoint & | control_point | |||
| ) |
Replace a specific control point.
- Parameters:
-
index the index of the control point control_point the replacement control point
Definition at line 130 of file bezier.cpp.
References fawkes::Transformable::clear_primitives(), and register_primitives().
| void fawkes::Bezier::set_control_points | ( | const std::vector< HomPoint > & | control_points | ) |
Set the control points.
- Parameters:
-
control_points the new control points
Definition at line 94 of file bezier.cpp.
References fawkes::Transformable::clear_primitives(), and register_primitives().
Referenced by subdivide().
Subdivide the curve into two polynome of the same degree.
- Parameters:
-
t determines the point where the curve is divided c the Bezier for the part [0, t] d the Bezier for the part [t, 1]
Definition at line 221 of file bezier.cpp.
References set_control_points().
| HomVector fawkes::Bezier::tangent_at_point | ( | unsigned int | index | ) |
Compute the tangent vector at the specified control point.
- Parameters:
-
index the index of the control point
- Returns:
- the tangent vector
Definition at line 204 of file bezier.cpp.
References tangent_at_t().
| HomVector fawkes::Bezier::tangent_at_t | ( | float | t | ) |
Compute the tangent vector at position t.
- Parameters:
-
t the curve parameter
- Returns:
- the tangent vector
Definition at line 189 of file bezier.cpp.
Referenced by tangent_at_point().
The documentation for this class was generated from the following files:
- src/libs/geometry/bezier.h
- src/libs/geometry/bezier.cpp

