<html> <head><title>ClanLib Reference: CL_BezierCurve</title></head> <body text=black link=blue vlink=#800080 bgcolor=white topmargin=0 leftmargin=0> <table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><img border=0 src="../images/eyeheader-main-purple-a.gif" alt="ClanSoft logo" width=525 height=96></td></tr> <tr bgcolor=#dadada><td align=left valign=top><img border=0 src="../images/eyeheader-main-purple-b.gif" alt="ClanSoft logo" width=190 height=14></td><td align=right valign=top><img border=0 src="../images/clanlib_light.gif" width=42 height=14></td></tr></table> <table align=center border=0 cellspacing=10> <tr> <td><a href="entire_class_index.html">Entire Class Index</a></td> <td><a href="class_index.html">Main Class Index</a></td> <td><a href="cross_index.html">Cross Index</a></td> <td><a href="global_index.html">Global Index</a></td> </table><h1 align=center>Class CL_BezierCurve</h1><p> <b> Class for Bezier curves</b><br> Contained in: <a href="global_index.html">global</a><br> Derived from: <i>none</i> <br> Derived by: <i>none</i> <br>Group: Core (Math) <p> #include <ClanLib/core.h> <p> <hr noshade> <table border=0> <tr><td colspan=3><h3>public function member index:</h3></td> <tr valign=top><td align=left><h3>Construction:</h3></td> <tr valign=top><td align=right><tt></tt> </td><td align=right><a href="CL_BezierCurve.html#716"><tt><font color=blue><b>CL_BezierCurve</b></font></tt></a></td><td><tt>(<tt>const</tt> <a href="CL_Vector.html"><tt><font color=navy><b>CL_Vector</b></font></tt></a>* <tt><font color=blue>cp</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>cs</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>steps</font></tt>, <tt><font color=purple>bool</font></tt> <tt><font color=blue>stepping</font></tt> = true)</tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> </tt> </td><td align=right><a href="CL_BezierCurve.html#717"><tt><font color=blue><b>~CL_BezierCurve</b></font></tt></a></td><td><tt>()</tt>;</td> <tr valign=top><td align=left><h3>Attributes:</h3></td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_BezierCurve.html#718"><tt><font color=blue><b>get_steps</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_BezierCurve.html#719"><tt><font color=blue><b>get_cs</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>bool</font></tt></tt> </td><td align=right><a href="CL_BezierCurve.html#720"><tt><font color=blue><b>get_stepping</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>float</font></tt></tt> </td><td align=right><a href="CL_BezierCurve.html#721"><tt><font color=blue><b>get_length</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>segment</font></tt> = -1) <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <a href="CL_Vector.html"><tt><font color=navy><b>CL_Vector</b></font></tt></a>*</tt> </td><td align=right><a href="CL_BezierCurve.html#722"><tt><font color=blue><b>get_curve</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <a href="CL_Vector.html"><tt><font color=navy><b>CL_Vector</b></font></tt></a>*</tt> </td><td align=right><a href="CL_BezierCurve.html#723"><tt><font color=blue><b>get_control_points</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=left><h3>Operations:</h3></td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_BezierCurve.html#724"><tt><font color=blue><b>set_steps</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>steps</font></tt>)</tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_BezierCurve.html#725"><tt><font color=blue><b>set_stepping</b></font></tt></a></td><td><tt>(<tt><font color=purple>bool</font></tt> <tt><font color=blue>stepping</font></tt>)</tt>;</td> <tr valign=top><td align=left><h3>Operators:</h3></td> <tr valign=top><td align=right><tt><a href="CL_Vector.html"><tt><font color=navy><b>CL_Vector</b></font></tt></a></tt> </td><td align=right><a href="CL_BezierCurve.html#726"><tt><font color=black><b>operator</b></font></tt><tt> [] </tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>n</font></tt>)</tt>;</td> <tr><td> </td><tr><td colspan=3><h3>protected function member index:</h3></td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_BezierCurve.html#715"><tt><font color=blue><b>make_curve</b></font></tt></a></td><td><tt>()</tt>;</td> <tr><td> </td></table> <hr noshade> <h2>Description:</h2> This class generates points on a Bezier curve from given control points<br><br> USE AT YOUR OWN RISK TILL THIS CLASS IS EXTENSIVELY TESTED!!! I WILL REMOVE THIS WARNING ONCE IT BASICALLY WORKS.<br><br> 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 :-) <br><br> 1999/12/30 vogel renamed CL_Bezier to <a href="CL_BezierCurve.html">CL_BezierCurve</a><br> added <a href="CL_BezierSurface.html">CL_BezierSurface</a><br><br> 1999/07/07 vogel initial version<br><br><br> BezierCurve TODO: <br><br> - length and stepping per curve<br><br> 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.<br><br> same applies to BezierSurface.<br><p> <hr noshade> <h2>Function Member Descriptions:</h2> <a name="716"><font size=+1><b>CL_BezierCurve::CL_BezierCurve</b></font></a> - Constructor<br><tt></tt> <a href="CL_BezierCurve.html#716"><tt><font color=blue><b>CL_BezierCurve</b></font></tt></a><tt>(<tt>const</tt> <a href="CL_Vector.html"><tt><font color=navy><b>CL_Vector</b></font></tt></a>* <tt><font color=blue>cp</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>cs</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>steps</font></tt>, <tt><font color=purple>bool</font></tt> <tt><font color=blue>stepping</font></tt> = true)</tt>;<br><blockquote> cp - an array of control points with size (4 * cs)<br> cs - number of curve segments<br> steps - number of points to generate<br> stepping - whether steps is the number of points per segment or per curve. </blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="723"><font size=+1><b>CL_BezierCurve::get_control_points</b></font></a> - Returns the 4 * cs control points<br><tt><tt>virtual</tt> <a href="CL_Vector.html"><tt><font color=navy><b>CL_Vector</b></font></tt></a>*</tt> <a href="CL_BezierCurve.html#723"><tt><font color=blue><b>get_control_points</b></font></tt></a><tt>() <tt>const</tt></tt>;<br><blockquote> Returns - the 4 * cs control points</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="719"><font size=+1><b>CL_BezierCurve::get_cs</b></font></a> - Returns the number of curve segments<br><tt><tt>virtual</tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_BezierCurve.html#719"><tt><font color=blue><b>get_cs</b></font></tt></a><tt>() <tt>const</tt></tt>;<br><blockquote> Returns - number of curve segments</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="722"><font size=+1><b>CL_BezierCurve::get_curve</b></font></a> - Returns an array of cs * steps CL_Vectors -> the curve<br><tt><tt>virtual</tt> <a href="CL_Vector.html"><tt><font color=navy><b>CL_Vector</b></font></tt></a>*</tt> <a href="CL_BezierCurve.html#722"><tt><font color=blue><b>get_curve</b></font></tt></a><tt>() <tt>const</tt></tt>;<br><blockquote> Returns - the curve (cs * steps CL_Vectors)</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="721"><font size=+1><b>CL_BezierCurve::get_length</b></font></a> - Returns the lenght of a segment (or the curve)<br><tt><tt>virtual</tt> <tt><font color=purple>float</font></tt></tt> <a href="CL_BezierCurve.html#721"><tt><font color=blue><b>get_length</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>segment</font></tt> = -1) <tt>const</tt></tt>;<br><blockquote> segment - number of segment (-1 indicates whole curve)<br> Returns - length of segment (or curve)</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="720"><font size=+1><b>CL_BezierCurve::get_stepping</b></font></a> - Returns whether steps is the number of points per segment or per curve.<br><tt><tt>virtual</tt> <tt><font color=purple>bool</font></tt></tt> <a href="CL_BezierCurve.html#720"><tt><font color=blue><b>get_stepping</b></font></tt></a><tt>() <tt>const</tt></tt>;<br><blockquote> Returns - stepping</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="718"><font size=+1><b>CL_BezierCurve::get_steps</b></font></a> - Returns the number of steps<br><tt><tt>virtual</tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_BezierCurve.html#718"><tt><font color=blue><b>get_steps</b></font></tt></a><tt>() <tt>const</tt></tt>;<br><blockquote> Returns - number of steps</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="726"><font size=+1><b>CL_BezierCurve::operator [] </b></font></a> - Returns the n-th vector of the curve (_doesn't_ return a reference)<br><tt><a href="CL_Vector.html"><tt><font color=navy><b>CL_Vector</b></font></tt></a></tt> <a href="CL_BezierCurve.html#726"><tt><font color=black><b>operator</b></font></tt><tt> [] </tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>n</font></tt>)</tt>;<br><blockquote> n - the vector to return (counting starts at 0)<br> Returns - the n-th vector of the curve (_doesn't_ return a reference)</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="725"><font size=+1><b>CL_BezierCurve::set_stepping</b></font></a> - Sets the stepping<br><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> <a href="CL_BezierCurve.html#725"><tt><font color=blue><b>set_stepping</b></font></tt></a><tt>(<tt><font color=purple>bool</font></tt> <tt><font color=blue>stepping</font></tt>)</tt>;<br><blockquote> stepping - whether steps is the number of points per segment or per curve.</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="724"><font size=+1><b>CL_BezierCurve::set_steps</b></font></a> - Sets the number of steps<br><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> <a href="CL_BezierCurve.html#724"><tt><font color=blue><b>set_steps</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>steps</font></tt>)</tt>;<br><blockquote> steps - number of steps</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="717"><font size=+1><b>CL_BezierCurve::~CL_BezierCurve</b></font></a> - Destructor<br><tt><tt>virtual</tt> </tt> <a href="CL_BezierCurve.html#717"><tt><font color=blue><b>~CL_BezierCurve</b></font></tt></a><tt>()</tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <hr noshade> <h2>Variable Member Descriptions:</h2> <hr noshade> </body> </html>