CurveBundle< Vector > Class Template Reference
[libbiarc]

The CurveBundle class for storing and manipulating biarc curves in $\mathcal{R}^3$. More...

#include <include/CurveBundle.h>

Inheritance diagram for CurveBundle< Vector >:

PKFmanip

List of all members.

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)
CurveBundleoperator= (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 ()
CurveBundleoperator+= (const Vector &vec)
CurveBundleoperator-= (const Vector &vec)
void center ()
Vector getCenter ()
CurveBundlescale (float s)
CurveBundlerotate (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 ()


Detailed Description

template<class Vector>
class CurveBundle< Vector >

The CurveBundle class for storing and manipulating biarc curves in $\mathcal{R}^3$.

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;
  }

See also:
Curve,Biarc

Constructor & Destructor Documentation

template<class Vector>
CurveBundle< Vector >::CurveBundle (  )  [inline]

Constructs an empty curve and sets the header to "No name","","",""

template<class Vector>
CurveBundle< Vector >::CurveBundle ( const char *  filename  )  [inline]

Constructs a CurveBundle object from a portable knot format data file (PKF file).

See also:
readPKF().

References CurveBundle< Vector >::readPKF().

template<class Vector>
CurveBundle< Vector >::CurveBundle ( const CurveBundle< Vector > &  cb  )  [inline]

Copy constructor.

See also:
operator=

template<class Vector>
CurveBundle< Vector >::~CurveBundle (  )  [inline]

Destructor.


Member Function Documentation

template<class Vector>
int CurveBundle< Vector >::curves (  )  const [inline]

template<class Vector>
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().

template<class Vector>
void CurveBundle< Vector >::link (  )  [inline]

This is the way to close all the curves at once.

See also:
unlink(), Curve::link(), Curve::unlink()

References CurveBundle< Vector >::curves().

template<class Vector>
void CurveBundle< Vector >::unlink (  )  [inline]

Opens all curves in bundle.

See also:
link(), Curve::link(), Curve::unlink()

References CurveBundle< Vector >::curves().

template<class Vector>
void CurveBundle< Vector >::newCurve ( Curve< Vector > &  c  )  [inline]

template<class Vector>
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().

template<class Vector>
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().

template<class Vector>
Curve< Vector > & CurveBundle< Vector >::operator[] ( int  c  )  [inline]

Return a reference to the curve number c.

template<class Vector>
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().

template<class Vector>
void CurveBundle< Vector >::make ( float  f  )  [inline]

Interpolate the curves in the bundle with biarcs. This function uses the same $\Gamma$ value for all curves!

See also:
Curve::make(), makeMidpointRule()

References CurveBundle< Vector >::curves().

template<class Vector>
void CurveBundle< Vector >::makeMidpointRule (  )  [inline]

Interpolate all the curves in the bundle with the midpoint matching rule.

See also:
Curve::make(), make()

References CurveBundle< Vector >::curves().

template<class Vector>
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!

See also:
refine(),make().

References CurveBundle< Vector >::curves().

template<class Vector>
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().

template<class Vector>
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.

See also:
scale(), Curve::normalize(), Curve::scale()

References CurveBundle< Vector >::curves(), CurveBundle< Vector >::length(), and CurveBundle< Vector >::scale().

template<class Vector>
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().

template<class Vector>
float CurveBundle< Vector >::thickness (  )  [inline]

Returns the thickness (biggest possible tube radius without self-intersection) of the curve bundle

template<class Vector>
float CurveBundle< Vector >::thickness_fast (  )  [inline]

Returns the "fast" thickness (pt radii only) of the curve bundle.

References CurveBundle< Vector >::curves().

template<class Vector>
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.

See also:
center(), operator-=()

References CurveBundle< Vector >::curves().

template<class Vector>
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.

See also:
operator+=()

References CurveBundle< Vector >::curves().

template<class Vector>
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>!!!

See also:
getCenter()

References CurveBundle< Vector >::getCenter().

template<class Vector>
Vector CurveBundle< Vector >::getCenter (  )  [inline]

Returns the bundles's center of mass.

See also:
center()

References CurveBundle< Vector >::curves().

Referenced by CurveBundle< Vector >::center().

template<class Vector>
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.

See also:
normalize()

References CurveBundle< Vector >::curves().

Referenced by CurveBundle< Vector >::normalize().

template<class Vector>
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().

template<class Vector>
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.

See also:
writePKF(),Curve::readPKF(),Curve::writePKF()

Referenced by CurveBundle< Vector >::CurveBundle().

template<class Vector>
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.

See also:
writePKF(),Curve::readPKF()

References CurveBundle< Vector >::newCurve(), and PKFmanip::readHeader().

template<class Vector>
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.

See also:
readPKF()

Referenced by CurveBundle< Vector >::writePKF().

template<class Vector>
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).

See also:
readPKF()

References CurveBundle< Vector >::curves(), PKFmanip::writeHeader(), and CurveBundle< Vector >::writePKF().

template<class Vector>
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.

See also:
writePKF(),Curve::readPKF(),Curve::writePKF()

References CurveBundle< Vector >::newCurve(), and Curve< Vector >::readXYZ().

template<class Vector>
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.

See also:
computeTangents(),polygonalToArcs(),arcsToPolygonal()
TODO : not ready, change DOC!!!

References CurveBundle< Vector >::newCurve(), and Curve< Vector >::readData().

template<class Vector>
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).

See also:
readData() TODO : not ready, change doc!!! TODO : not ready!!!

References CurveBundle< Vector >::curves().

template<class Vector>
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.

See also:
computeTangents(),polygonalToArcs(),arcsToPolygonal(),writeVECT()

References Curve< Vector >::append(), Curve< Vector >::computeTangents(), Curve< Vector >::flush_all(), Curve< Vector >::link(), and CurveBundle< Vector >::newCurve().

Referenced by CurveInterface::load().

template<class Vector>
int CurveBundle< Vector >::writeVECT ( const char *  outfile  )  [inline]

template<class Vector>
void CurveBundle< Vector >::computeTangents (  )  [inline]

Comptes the tangents on each curve in the bundle.

See also:
Curve::computeTangents()

References CurveBundle< Vector >::curves().

Referenced by CurveInterface::load().

template<class Vector>
void CurveBundle< Vector >::polygonalToArcs (  )  [inline]

This function converts all polygonal curves into curves made of arcs of circles.

See also:
arcsTolPolygonal(), Curve::polygonalToArcs()

References CurveBundle< Vector >::curves().

template<class Vector>
void CurveBundle< Vector >::arcsToPolygonal (  )  [inline]

This function converts all the biarc curves into polygonal curves.

See also:
polygonalToArcs(),Curve::arcsToPolygonal

References CurveBundle< Vector >::curves().


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

Generated on Mon Feb 8 17:22:36 2010 for libbiarc by  doxygen 1.5.6