#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. |
A Bezier curve class.
Definition at line 34 of file bezier.h.
fawkes::Bezier::Bezier | ( | ) |
fawkes::Bezier::Bezier | ( | const std::vector< HomPoint > & | control_points | ) |
Constructor.
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.
b | another Bezier curve |
Definition at line 67 of file bezier.cpp.
References fawkes::Transformable::clear_primitives(), and register_primitives().
fawkes::Bezier::~Bezier | ( | ) |
Destructor.
Definition at line 82 of file bezier.cpp.
const vector< HomPoint > & fawkes::Bezier::approximate | ( | unsigned int | num_subdivisions = 4 |
) |
Approximate the curve with points.
num_subdivisions | the number of subdivisions that is performed |
Definition at line 253 of file bezier.cpp.
Referenced by fawkes::BezierDrawer::draw().
unsigned int fawkes::Bezier::degree | ( | ) | const |
Get the degree of the polynom.
Definition at line 167 of file bezier.cpp.
HomPoint fawkes::Bezier::eval | ( | float | t | ) |
Evalutate the polynom for a given t.
t | a value between 0.0 and 1.0 |
Definition at line 177 of file bezier.cpp.
HomPoint fawkes::Bezier::get_control_point | ( | unsigned int | i | ) | const |
Get a specific control point.
i | the index of the control point |
Definition at line 155 of file bezier.cpp.
std::vector< HomPoint > fawkes::Bezier::get_control_points | ( | ) | const |
Get 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 367 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 354 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.
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.
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.
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 222 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.
index | the index of the control point |
Definition at line 205 of file bezier.cpp.
References tangent_at_t().
HomVector fawkes::Bezier::tangent_at_t | ( | float | t | ) |
Compute the tangent vector at position t.
t | the curve parameter |
Definition at line 190 of file bezier.cpp.
Referenced by tangent_at_point().