#include <include/CurveBundle.h>
Public Member Functions | |
int | curves () const |
int | nodes () const |
void | link () |
void | unlink () |
void | newCurve (Curve< Vector > &c) |
void | newCurve (istream &in) |
void | newCurve (Curve< Vector > *c) |
Curve< Vector > & | operator[] (int c) |
CurveBundle () | |
CurveBundle (const char *filename) | |
CurveBundle (const CurveBundle &cb) | |
CurveBundle & | operator= (const CurveBundle &cb) |
~CurveBundle () | |
void | make (float f) |
void | makeMidpointRule () |
void | resample (int NewNoNodes) |
void | changeDirection () |
void | normalize () |
float | length () |
float | thickness () |
float | thickness_fast () |
CurveBundle & | operator+= (const Vector &vec) |
CurveBundle & | operator-= (const Vector &vec) |
void | center () |
Vector | getCenter () |
CurveBundle & | scale (float s) |
CurveBundle & | rotate (Matrix3 &m) |
int | readPKF (const char *infile) |
int | readPKF (istream &in) |
int | writePKF (const char *outfile) |
int | writePKF (ostream &out) |
int | readXYZ (const char *infile) |
int | readData (const char *infile, const char *delimiter=" ") |
int | writeData (const char *outfile, const char *delimiter=" ", int tangents_flag=0) |
int | readVECT (const char *infile) |
int | writeVECT (const char *outfile) |
void | computeTangents () |
void | polygonalToArcs () |
void | arcsToPolygonal () |
This class is used to store and manipulate a set of curves. This data can be interpolated to a biarc curve. The class is for open and closed curves, but this must be specified (how to do that is explained later in this text).
#include "../include/CurveBundle.h" int main() { int N = 100; CurveBundle<Vector3> borromean; Curve<Vector3> c[3]; ... construct curves (see objects/borromean.cpp) ... for (int i=0;i<3;i++) borromean.newCurve(c[i]); return 0; }
CurveBundle< Vector >::CurveBundle | ( | ) | [inline] |
Constructs an empty curve and sets the header to "No name","","",""
CurveBundle< Vector >::CurveBundle | ( | const char * | filename | ) | [inline] |
Constructs a CurveBundle object from a portable knot format data file (PKF file).
References CurveBundle< Vector >::readPKF().
CurveBundle< Vector >::CurveBundle | ( | const CurveBundle< Vector > & | cb | ) | [inline] |
Copy constructor.
CurveBundle< Vector >::~CurveBundle | ( | ) | [inline] |
Destructor.
int CurveBundle< Vector >::curves | ( | ) | const [inline] |
Returns the number of curves currently stored in the bundle.
Referenced by CurveBundle< Vector >::arcsToPolygonal(), CurveBundle< Vector >::changeDirection(), CurveBundle< Vector >::computeTangents(), CurveBundle< Vector >::getCenter(), CurveBundle< Vector >::length(), CurveBundle< Vector >::link(), CurveInterface::load(), CurveBundle< Vector >::make(), CurveBundle< Vector >::makeMidpointRule(), CurveBundle< Vector >::nodes(), CurveBundle< Vector >::normalize(), CurveBundle< Vector >::operator+=(), CurveBundle< Vector >::operator-=(), CurveBundle< Vector >::operator=(), CurveBundle< Vector >::polygonalToArcs(), CurveBundle< Vector >::resample(), CurveBundle< Vector >::rotate(), CurveBundle< Vector >::scale(), CurveBundle< Vector >::thickness_fast(), TubeBundle< Vector >::TubeBundle(), CurveBundle< Vector >::unlink(), CurveBundle< Vector >::writeData(), CurveBundle< Vector >::writePKF(), and CurveBundle< Vector >::writeVECT().
int CurveBundle< Vector >::nodes | ( | ) | const [inline] |
Returns the total number of nodes of the Bundle (i.e. the sum of the number of nodes of each curve)
References CurveBundle< Vector >::curves().
Referenced by CurveBundle< Vector >::writeVECT().
void CurveBundle< Vector >::link | ( | ) | [inline] |
This is the way to close all the curves at once.
References CurveBundle< Vector >::curves().
void CurveBundle< Vector >::unlink | ( | ) | [inline] |
Opens all curves in bundle.
References CurveBundle< Vector >::curves().
void CurveBundle< Vector >::newCurve | ( | Curve< Vector > & | c | ) | [inline] |
Add a new curve c to the bundle.
Referenced by CurveBundle< Vector >::newCurve(), CurveBundle< Vector >::readData(), CurveBundle< Vector >::readPKF(), CurveBundle< Vector >::readVECT(), and CurveBundle< Vector >::readXYZ().
void CurveBundle< Vector >::newCurve | ( | istream & | in | ) | [inline] |
Read a new curve from the stream in and add it to the bundle.
References CurveBundle< Vector >::newCurve().
void CurveBundle< Vector >::newCurve | ( | Curve< Vector > * | c | ) | [inline] |
Takes an already valid curve object pointer and adds this as a component to the current Bundle
References CurveBundle< Vector >::newCurve().
Curve< Vector > & CurveBundle< Vector >::operator[] | ( | int | c | ) | [inline] |
Return a reference to the curve number c.
CurveBundle< Vector > & CurveBundle< Vector >::operator= | ( | const CurveBundle< Vector > & | cb | ) | [inline] |
Assign operator. Copies the header structure from c. Copies all the curves in this bundle (i.e. all the point/tangent data and closes the curve if necessary).
References CurveBundle< Vector >::bundle, and CurveBundle< Vector >::curves().
void CurveBundle< Vector >::make | ( | float | f | ) | [inline] |
Interpolate the curves in the bundle with biarcs. This function uses the same value for all curves!
References CurveBundle< Vector >::curves().
void CurveBundle< Vector >::makeMidpointRule | ( | ) | [inline] |
Interpolate all the curves in the bundle with the midpoint matching rule.
References CurveBundle< Vector >::curves().
void CurveBundle< Vector >::resample | ( | int | NewNoNodes | ) | [inline] |
This function resamples all curves in the bundle with NewNoNodes nodes.
resample() can only be done if we have an interpolated set of curves!
References CurveBundle< Vector >::curves().
void CurveBundle< Vector >::changeDirection | ( | ) | [inline] |
Change the orientation of all the curves in the bundle. This means flipping the tangents and reordering the points.
References CurveBundle< Vector >::curves().
void CurveBundle< Vector >::normalize | ( | ) | [inline] |
Normalize the length of the sum of curve lengths! This means that for 10 curves with length 1 in the bundle, the length will be 1/10 after normalisation!
An interpolated curve is necessary to compute the length of it.
References CurveBundle< Vector >::curves(), CurveBundle< Vector >::length(), and CurveBundle< Vector >::scale().
float CurveBundle< Vector >::length | ( | ) | [inline] |
Returns the total length of the bundle. This is the sum of the arc-length of all the stored curves.
References CurveBundle< Vector >::curves().
Referenced by CurveBundle< Vector >::normalize().
float CurveBundle< Vector >::thickness | ( | ) | [inline] |
Returns the thickness (biggest possible tube radius without self-intersection) of the curve bundle
float CurveBundle< Vector >::thickness_fast | ( | ) | [inline] |
Returns the "fast" thickness (pt radii only) of the curve bundle.
References CurveBundle< Vector >::curves().
CurveBundle< Vector > & CurveBundle< Vector >::operator+= | ( | const Vector & | v | ) | [inline] |
Translates all the curves by v.
Redo the interpolation after this operation if the initial curve was biarc interpolated, since the matching points and bezier points are no longer correct.
References CurveBundle< Vector >::curves().
CurveBundle< Vector > & CurveBundle< Vector >::operator-= | ( | const Vector & | v | ) | [inline] |
Translate all the curves by -v.
Redo the interpolation after this operation if the initial curve was biarc interpolated, since the matching points and bezier points are no longer correct.
References CurveBundle< Vector >::curves().
void CurveBundle< Vector >::center | ( | ) | [inline] |
This function shifts the center of mass of the bundle to <0,0,0>. This is different from : centering each particular the curve in the bundle to <0,0,0>!!!
References CurveBundle< Vector >::getCenter().
Vector CurveBundle< Vector >::getCenter | ( | ) | [inline] |
Returns the bundles's center of mass.
References CurveBundle< Vector >::curves().
Referenced by CurveBundle< Vector >::center().
CurveBundle< Vector > & CurveBundle< Vector >::scale | ( | float | s | ) | [inline] |
Scales the length of the curves by s. The curves need not to be interpolated, since only the data points are changed. Returns a reference to itself.
References CurveBundle< Vector >::curves().
Referenced by CurveBundle< Vector >::normalize().
CurveBundle< Vector > & CurveBundle< Vector >::rotate | ( | Matrix3 & | m | ) | [inline] |
Applies the rotation specified by a rotation matrix m to each curve in the bundle. No check is done for m, the user must know what matrix he wants to apply.
This is not the standart 4x4 transformation matrix approach known from homogeneous coordinates stuff.
References CurveBundle< Vector >::curves().
int CurveBundle< Vector >::readPKF | ( | const char * | infile | ) | [inline] |
Read data from a PKF file infile. More details are in the class Curve documentation. This class can store more than 1 curve!
Returns 1 if all went well, zero otherwise.
Referenced by CurveBundle< Vector >::CurveBundle().
int CurveBundle< Vector >::readPKF | ( | istream & | in | ) | [inline] |
Read the curves from a stream in. More details about the PKF data format are given in the Curve class documentation.
References CurveBundle< Vector >::newCurve(), and PKFmanip::readHeader().
int CurveBundle< Vector >::writePKF | ( | const char * | outfile | ) | [inline] |
Writes the current curves to a PKF file outfile. This goes through all components and writes them to the file.
Returns 1 if all went well, zero otherwise.
Referenced by CurveBundle< Vector >::writePKF().
int CurveBundle< Vector >::writePKF | ( | ostream & | out | ) | [inline] |
Writes the current CurveBundle instance to the stream out. (I.e. header, number of curves and the curve data).
References CurveBundle< Vector >::curves(), PKFmanip::writeHeader(), and CurveBundle< Vector >::writePKF().
int CurveBundle< Vector >::readXYZ | ( | const char * | infile | ) | [inline] |
Read data from a XYZ file infile. More details are in the class Curve documentation. This class can store more than 1 curve!
Returns 1 if all went well, zero otherwise.
References CurveBundle< Vector >::newCurve(), and Curve< Vector >::readXYZ().
int CurveBundle< Vector >::readData | ( | const char * | infile, | |
const char * | delimiter = " " | |||
) | [inline] |
This function reads the curve data from a file infile. The file structure is a list of x,y,z coordinates. The default for the delimiter is " ", but can be changed with the second argument of the function.
The first line gives the number of nodes in the following format {nodes}. Then the coordinates are read in. The delimiter argument is any string that separates the coordinate values from each other, the default value is a space ' ' delimiter.
Returns 1 if all went well, zero otherwise.
TODO : not ready, change DOC!!!
References CurveBundle< Vector >::newCurve(), and Curve< Vector >::readData().
int CurveBundle< Vector >::writeData | ( | const char * | outfile, | |
const char * | delimiter = " " , |
|||
int | tangents_flag = 0 | |||
) | [inline] |
Writes the curve to a data file. First line is the number of points and then follows a list of x,y,z coordinates. If the tangents_flag is set to 1, the tangents of the points are also dropped (Default is 0).
References CurveBundle< Vector >::curves().
int CurveBundle< Vector >::readVECT | ( | const char * | infile | ) | [inline] |
Read a file in VECT format. Infos about the format at
http://www.geomview.org/docs/html/geomview_42.html
Returns 1 if all went well, zero otherwise. Does not support the whole VECT spec.
References Curve< Vector >::append(), Curve< Vector >::computeTangents(), Curve< Vector >::flush_all(), Curve< Vector >::link(), and CurveBundle< Vector >::newCurve().
Referenced by CurveInterface::load().
int CurveBundle< Vector >::writeVECT | ( | const char * | outfile | ) | [inline] |
Not implemented
References CurveBundle< Vector >::curves(), and CurveBundle< Vector >::nodes().
void CurveBundle< Vector >::computeTangents | ( | ) | [inline] |
Comptes the tangents on each curve in the bundle.
References CurveBundle< Vector >::curves().
Referenced by CurveInterface::load().
void CurveBundle< Vector >::polygonalToArcs | ( | ) | [inline] |
This function converts all polygonal curves into curves made of arcs of circles.
References CurveBundle< Vector >::curves().
void CurveBundle< Vector >::arcsToPolygonal | ( | ) | [inline] |
This function converts all the biarc curves into polygonal curves.
References CurveBundle< Vector >::curves().