TubeBundle< Vector > Class Template Reference
[libbiarc]

The TubeBundle class contains the mesh of a tube around a curve in $\mathcal{R}^3$. More...

#include <include/TubeBundle.h>

Inheritance diagram for TubeBundle< Vector >:

PKFmanip

List of all members.

Public Member Functions

void clear_tb ()
 TubeBundle ()
 TubeBundle (const char *filename)
 TubeBundle (const TubeBundle< Vector > &tb)
 TubeBundle (const CurveBundle< Vector > &cb)
TubeBundle< Vector > & operator= (const TubeBundle< Vector > &tb)
 ~TubeBundle ()
int tubes () const
void newTube (const Tube< Vector > &t)
void newTube (istream &in)
Tube< Vector > & operator[] (int c)
void makeMesh (int N, int S, float R, float Tol=-1.0)
void getBoundingBox (Vector &BBox_Min, Vector &BBox_Max)
Vector & getCenter ()
void scaleTubeRadius (float NewRadius)
int readPKF (const char *infile)
int readXYZ (const char *infile)
int readPKF (istream &in)
int readData (const char *infile, const char *delimiter=" ")


Detailed Description

template<class Vector>
class TubeBundle< Vector >

The TubeBundle class contains the mesh of a tube around a curve in $\mathcal{R}^3$.

This class is used to store the points and normals of a tubular mesh around a space-curve.

The usage of TubeBundle objects are shown in the following example :

  #include "../include/TubeBundle.h"
  
  main(int argc, char **argv) {
  
    // Read curve data from a file
    TubeBundle t("curve.pkf");

    // Close the curve
    t.link();

    // Number of nodes on the curve
    int N = t.nodes();

    // We want 10 segments on the cross section
    int S = 10;

    // The radius is set to 1.0
    float R = 1.0;

    // We match up the mesh with this tolerance value
    float Tol = 1e-3;

    // Generate mesh points and normals
    t.makeMesh(N,S,R,Tol);

    ...

    // Write the output to standart out
    cout << t << endl;

    ...

    return 0;
  }

See also:
Curve, Biarc

Constructor & Destructor Documentation

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

Default constructor. Creates an empty tube bundle.

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

Constructor reads the curves data from infile and stores it in a Tube container. No interpolation is done, and no mesh points are generated. A call to makeMesh() is necessary to generate the mesh points for all the curves.

See also:
makeMesh(),Tube::makeMesh()

References TubeBundle< Vector >::readPKF().

template<class Vector>
TubeBundle< Vector >::TubeBundle ( const TubeBundle< Vector > &  tb  )  [inline]

Constructor copies a TubeBundle object tube. Only the curve data points are copied and the curve is closed if necessary. No interpolation and no mesh generation is done in the new TubeBundle instance. To do that makeMesh() must be called.

Maybe this will be changed in the future to copy all the mesh points if the tube object has mesh points.

See also:
makeMesh()

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

Constructor copies a Curve object curve. No interpolation and no mesh generation is done. To do that makeMesh() must be called.

See also:
makeMesh()

References CurveBundle< Vector >::curves(), and TubeBundle< Vector >::newTube().

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

Destructor. Clears the memory used by the mesh points and normals.


Member Function Documentation

template<class Vector>
TubeBundle< Vector > & TubeBundle< Vector >::operator= ( const TubeBundle< Vector > &  tb  )  [inline]

Assign operator. Copies the curve data and calls link() if TubeBundle c is closed.

References TubeBundle< Vector >::container, and TubeBundle< Vector >::tubes().

template<class Vector>
int TubeBundle< Vector >::tubes (  )  const [inline]

template<class Vector>
void TubeBundle< Vector >::newTube ( const Tube< Vector > &  t  )  [inline]

template<class Vector>
void TubeBundle< Vector >::newTube ( istream &  in  )  [inline]

Read the curve data from a stream in. The curve is converted into a Tube object and added to the TubeBundle.

References TubeBundle< Vector >::newTube().

template<class Vector>
Tube< Vector > & TubeBundle< Vector >::operator[] ( int  c  )  [inline]

Return a reference to the tube number c in the TubeBundle container.

template<class Vector>
void TubeBundle< Vector >::makeMesh ( int  N,
int  S,
float  R,
float  Tol = -1.0 
) [inline]

Creates a tubular mesh with radius R around the curve with N nodes and S segments on each cross sectional circle. If the actually stored curve has not exactly N nodes, the Curve::resample() routine is called automatically.

The parameter Tol is the precision used to math up the mesh of a closed curve. Tol is the difference in radians of the angle between the first and the last normal of the sequence of curve frames.

Use Tol = -1 (default) for no torsion adjustment and open curves.

Computes also the mesh normals at each point where the normal is an average of the neighbouring face normals. (The normals are used for Gouraud shading in visualisation programs).

At the end the center of mass and the bounding box are computed.

The interpolation in case of a resampling is done with Gamma = 0.5.

References TubeBundle< Vector >::tubes().

Referenced by CurveInterface::makeMesh().

template<class Vector>
void TubeBundle< Vector >::getBoundingBox ( Vector &  BBox_Min,
Vector &  BBox_Max 
) [inline]

Puts the position of the minimum and the maximum corner of a box containing the whole tubular object into the vectors BBox_Min and BBox_Max.

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

Returns the center of mass of the tubular mesh.

template<class Vector>
void TubeBundle< Vector >::scaleTubeRadius ( float  NewRadius  )  [inline]

Inflates or deflates the existing mesh according to the new radius given. All the cross sectional circles are changed to have radius NewRadius. This function drops an error message if there are no valid mesh points.

The bounding box values are updated at the end of the process.

References TubeBundle< Vector >::tubes().

template<class Vector>
int TubeBundle< Vector >::readPKF ( const char *  infile  )  [inline]

Read a PKF file with more than one curve from infile.

Referenced by CurveInterface::load(), and TubeBundle< Vector >::TubeBundle().

template<class Vector>
int TubeBundle< Vector >::readXYZ ( const char *  infile  )  [inline]

template<class Vector>
int TubeBundle< Vector >::readPKF ( istream &  in  )  [inline]

Read a PKF file with more than one curve from istream in.

References TubeBundle< Vector >::newTube(), and PKFmanip::readHeader().

template<class Vector>
int TubeBundle< Vector >::readData ( const char *  infile,
const char *  delimiter = " " 
) [inline]

Read a data file. This routine has been used for different file formats. If needed, adapt it ;)

References TubeBundle< Vector >::newTube(), and Curve< Vector >::readData().


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