Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_BezierCurve

Class for Bezier curves
Contained in: global
Derived from: none
Derived by: none
Group: Core (Math)

#include <ClanLib/core.h>

### public function member index:

### Construction:

`` | `CL_BezierCurve` | `(`const` `CL_Vector`* `cp`, `int` `cs`, `int` `steps`, `bool` `stepping` = true)`;
``virtual`` | `~CL_BezierCurve` | `()`;

### Attributes:

``virtual` `int`` | `get_steps` | `() `const``;
``virtual` `int`` | `get_cs` | `() `const``;
``virtual` `bool`` | `get_stepping` | `() `const``;
``virtual` `float`` | `get_length` | `(`int` `segment` = -1) `const``;
``virtual` `CL_Vector`*` | `get_curve` | `() `const``;
``virtual` `CL_Vector`*` | `get_control_points` | `() `const``;

### Operations:

``virtual` `void`` | `set_steps` | `(`int` `steps`)`;
``virtual` `void`` | `set_stepping` | `(`bool` `stepping`)`;

### Operators:

``CL_Vector`` | `operator``[]` | `(`int` `n`)`;

### protected function member index:

``virtual` `void`` | `make_curve` | `()`;

## Description:

This class generates points on a Bezier curve from given control points
USE AT YOUR OWN RISK TILL THIS CLASS IS EXTENSIVELY TESTED!!! I WILL REMOVE THIS WARNING ONCE IT BASICALLY WORKS.
I hate documentation work and I won't document this code before any one besides me actually uses it. So if you want to use it simply write a mail on the ClanLib User list and I will do what I can :-)
1999/12/30 vogel renamed CL_Bezier to CL_BezierCurve
added CL_BezierSurface
1999/07/07 vogel initial version
BezierCurve TODO:
- length and stepping per curve
stepping per curve means that the generated points are equidistant to each other and this requires get_length() working. So at the moment all that is working is having 'n' equidistant points per segment.
same applies to BezierSurface.

## Function Member Descriptions:

CL_BezierCurve::CL_BezierCurve - Constructor
`` `CL_BezierCurve` `(`const` `CL_Vector`* `cp`, `int` `cs`, `int` `steps`, `bool` `stepping` = true)`;

> cp - an array of control points with size (4 * cs)
> cs - number of curve segments
> steps - number of points to generate
> stepping - whether steps is the number of points per segment or per curve.

CL_BezierCurve::get_control_points - Returns the 4 * cs control points
``virtual` `CL_Vector`*` `get_control_points` `() `const``;

> Returns - the 4 * cs control points

CL_BezierCurve::get_cs - Returns the number of curve segments
``virtual` `int`` `get_cs` `() `const``;

> Returns - number of curve segments

CL_BezierCurve::get_curve - Returns an array of cs * steps CL_Vectors -> the curve
``virtual` `CL_Vector`*` `get_curve` `() `const``;

> Returns - the curve (cs * steps CL_Vectors)

CL_BezierCurve::get_length - Returns the lenght of a segment (or the curve)
``virtual` `float`` `get_length` `(`int` `segment` = -1) `const``;

> segment - number of segment (-1 indicates whole curve)
> Returns - length of segment (or curve)

CL_BezierCurve::get_stepping - Returns whether steps is the number of points per segment or per curve.
``virtual` `bool`` `get_stepping` `() `const``;

> Returns - stepping

CL_BezierCurve::get_steps - Returns the number of steps
``virtual` `int`` `get_steps` `() `const``;

> Returns - number of steps

CL_BezierCurve::operator [] - Returns the n-th vector of the curve (_doesn't_ return a reference)
``CL_Vector`` `operator``[]` `(`int` `n`)`;

> n - the vector to return (counting starts at 0)
> Returns - the n-th vector of the curve (_doesn't_ return a reference)

CL_BezierCurve::set_stepping - Sets the stepping
``virtual` `void`` `set_stepping` `(`bool` `stepping`)`;

> stepping - whether steps is the number of points per segment or per curve.

CL_BezierCurve::set_steps - Sets the number of steps
``virtual` `void`` `set_steps` `(`int` `steps`)`;

> steps - number of steps

CL_BezierCurve::~CL_BezierCurve - Destructor
``virtual`` `~CL_BezierCurve` `()`;

## Variable Member Descriptions: