Claw  1.7.3
Classes | Public Types | Public Member Functions | List of all members
claw::math::curve< C, Traits > Class Template Reference

Implementation of the Bézier curve. More...

#include <curve.hpp>

Classes

class  control_point
 The control_point class describes a control point of the curve, with the direction of the curve before and after the point. More...
class  section
 A section is a part of the curve between two control points. More...

Public Types

typedef C coordinate_type
 The type of the coordinates of the curve.
typedef Traits traits_type
 The traits provide an access to the properties of the coordinates.
typedef traits_type::value_type value_type
 The type of the components of the coordinates.
typedef
control_point_list::iterator 
iterator
 The type of the iterator on the control points of the curve.
typedef
control_point_list::const_iterator 
const_iterator
 The type of the iterator on the control points of the curve.

Public Member Functions

void push_back (const control_point &p)
 Add a point at the end of the curve.
void push_front (const control_point &p)
 Add a point at the beginning of the curve.
void insert (const iterator &pos, const control_point &p)
 Add a point before an other point of the curve.
section get_section (const const_iterator &pos) const
 Get the section of the curve starting at a given control point.
std::vector< typename
section::resolved_point
get_point_at_x (value_type x, bool off_domain=false) const
 Get the points having the given x-coordinate on the curve.
iterator begin ()
 Get an iterator on the first control point.
iterator end ()
 Get an iterator past the last control point.
const_iterator begin () const
 Get an iterator on the first control point.
const_iterator end () const
 Get an iterator past the last control point.

Detailed Description

template<typename C, typename Traits = coordinate_traits<C>>
class claw::math::curve< C, Traits >

Implementation of the Bézier curve.

The curve is made of a sequence of points, each of which having a direction telling how the curve enters the point and how to leave.

Author
Julien Jorge

Definition at line 49 of file curve.hpp.

Member Function Documentation

template<typename C , typename Traits >
std::vector< typename claw::math::curve< C, Traits >::section::resolved_point > claw::math::curve< C, Traits >::get_point_at_x ( value_type  x,
bool  off_domain = false 
) const

Get the points having the given x-coordinate on the curve.

Parameters
xThe coordinate for which we want the points.
off_domainTell the method to keep the points found at a date outside [0, 1].
Todo:
Remove the duplicates in the result.

Definition at line 607 of file curve.tpp.

References claw::math::curve< C, Traits >::begin(), claw::math::curve< C, Traits >::section::empty(), claw::math::curve< C, Traits >::end(), claw::math::curve< C, Traits >::section::get_point_at_x(), and claw::math::curve< C, Traits >::get_section().

template<typename C , typename Traits >
claw::math::curve< C, Traits >::section claw::math::curve< C, Traits >::get_section ( const const_iterator pos) const

Get the section of the curve starting at a given control point.

Parameters
posAn iterator of the control point at which the returned section begins.

Definition at line 584 of file curve.tpp.

References claw::math::curve< C, Traits >::end().

Referenced by claw::math::curve< C, Traits >::get_point_at_x().

template<typename C , typename Traits >
void claw::math::curve< C, Traits >::insert ( const iterator pos,
const control_point p 
)

Add a point before an other point of the curve.

Parameters
posAn iterator on the point before which the control point is added.
pThe point to add.

Definition at line 571 of file curve.tpp.

template<typename C , typename Traits >
void claw::math::curve< C, Traits >::push_back ( const control_point p)

Add a point at the end of the curve.

Parameters
pThe point to add.

Definition at line 547 of file curve.tpp.

template<typename C , typename Traits >
void claw::math::curve< C, Traits >::push_front ( const control_point p)

Add a point at the beginning of the curve.

Parameters
pThe point to add.

Definition at line 558 of file curve.tpp.


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