Fawkes API  Fawkes Development Version
fawkes::Bezier Class Reference

A Bezier curve class. More...

#include <>>

Inheritance diagram for fawkes::Bezier:

List of all members.

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< HomPointget_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.

Author:
Daniel Beck

Constructor & Destructor Documentation

fawkes::Bezier::Bezier ( )

Constructor.

Definition at line 38 of file bezier.cpp.

fawkes::Bezier::Bezier ( const std::vector< HomPoint > &  control_points)

Constructor.

Parameters:
control_pointsthe 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:
banother 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.


Member Function Documentation

const vector< HomPoint > & fawkes::Bezier::approximate ( unsigned int  num_subdivisions = 4)

Approximate the curve with points.

Parameters:
num_subdivisionsthe number of subdivisions that is performed
Returns:
the point approximating the curve

Definition at line 253 of file bezier.cpp.

References subdivide().

unsigned int fawkes::Bezier::degree ( ) const

Get the degree of the polynom.

Returns:
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.

Parameters:
ta value between 0.0 and 1.0
Returns:
the corresponding point on the curve

Definition at line 177 of file bezier.cpp.

HomPoint fawkes::Bezier::get_control_point ( unsigned int  i) const

Get a specific control point.

Parameters:
ithe index of the control point
Returns:
control point

Definition at line 155 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 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_points(), and set_control_point().

void fawkes::Bezier::set_control_point ( unsigned int  index,
const HomPoint control_point 
)

Replace a specific control point.

Parameters:
indexthe index of the control point
control_pointthe 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_pointsthe new control points

Definition at line 94 of file bezier.cpp.

References fawkes::Transformable::clear_primitives(), and register_primitives().

Referenced by subdivide().

void fawkes::Bezier::subdivide ( float  t,
Bezier c,
Bezier d 
)

Subdivide the curve into two polynome of the same degree.

Parameters:
tdetermines the point where the curve is divided
cthe Bezier for the part [0, t]
dthe Bezier for the part [t, 1]

Definition at line 222 of file bezier.cpp.

References set_control_points().

Referenced by approximate().

HomVector fawkes::Bezier::tangent_at_point ( unsigned int  index)

Compute the tangent vector at the specified control point.

Parameters:
indexthe index of the control point
Returns:
the tangent vector

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.

Parameters:
tthe curve parameter
Returns:
the tangent vector

Definition at line 190 of file bezier.cpp.

Referenced by tangent_at_point().


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