Tube< Vector > Class Template Reference
[libbiarc]

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

#include <include/Tube.h>

Inheritance diagram for Tube< Vector >:

Curve< Vector > PKFmanip

List of all members.

Public Member Functions

 Tube ()
 Tube (istream &in)
 Tube (const Curve< Vector > &curve)
 Tube (const Tube< Vector > &tube)
Tubeoperator= (const Tube< Vector > &t)
 ~Tube ()
void init ()
void clear_tube ()
Vector & meshPoint (int i)
Vector & meshNormal (int i)
int segments ()
float radius ()
void makeMesh (int N, int S, float R, float Tol=-1.0)
void getBoundingBox (Vector &BBox_BL, Vector &BBox_UR)
Vector & getCenter ()
void scaleTubeRadius (float NewRadius)


Detailed Description

template<class Vector>
class Tube< Vector >

The Tube 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 Tube objects are shown in the following example :

  #include "../include/Tube.h"
  
  main(int argc, char **argv) {
  
    // Read curve data from a file
    Tube 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>
Tube< Vector >::Tube (  )  [inline]

Default constructor. Creates an empty curve with no mesh points.

References Tube< Vector >::init().

template<class Vector>
Tube< Vector >::Tube ( istream &  in  )  [inline]

Constructs a new Tube object, reading the curve data from a stream in. Header is automatically set to the default values and is NOT expected to on the stream!

See also:
makeMesh()

References Tube< Vector >::init().

template<class Vector>
Tube< Vector >::Tube ( const Curve< Vector > &  curve  )  [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 Tube< Vector >::init().

template<class Vector>
Tube< Vector >::Tube ( const Tube< Vector > &  tube  )  [inline]

Constructor copies a Tube 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 Tube 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()

References Tube< Vector >::init().

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

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

References Tube< Vector >::clear_tube().


Member Function Documentation

template<class Vector>
Tube< Vector > & Tube< Vector >::operator= ( const Tube< Vector > &  c  )  [inline]

template<class Vector>
void Tube< Vector >::init (  )  [inline]

Initialize Tube object. Number of segments and the radius are set to 0.0. The mesh point table and the mesh normal table are set to NULL.

Reimplemented from Curve< Vector >.

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

template<class Vector>
void Tube< Vector >::clear_tube (  )  [inline]

Deletes the mesh points and the mesh normals.

Referenced by Tube< Vector >::makeMesh(), and Tube< Vector >::~Tube().

template<class Vector>
Vector & Tube< Vector >::meshPoint ( int  i  )  [inline]

Returns mesh point number i. There are a total of $(segments+1)\cdot (nodes+1)$ mesh points.

Referenced by SoKnot::generatePrimitives().

template<class Vector>
Vector & Tube< Vector >::meshNormal ( int  i  )  [inline]

Returns mesh normal number i. There are a total of $(segments+1)\cdot (nodes+1)$ mesh normals.

Referenced by SoKnot::generatePrimitives().

template<class Vector>
int Tube< Vector >::segments (  )  [inline]

Returns the number of segments on the tubular cross section.

See also:
Curve::nodes(),radius()

Referenced by SoKnot::GLRender(), SoKnot::setKnot(), and SoKnot::updateMesh().

template<class Vector>
float Tube< Vector >::radius (  )  [inline]

Returns the current radius of the tubular curve.

See also:
Curve::nodes(),segments()

Referenced by SoKnot::setKnot(), and SoKnot::updateMesh().

template<class Vector>
void Tube< 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 actully 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 Curve< Vector >::_Closed, Curve< Vector >::begin(), Matrix3::cay(), Tube< Vector >::clear_tube(), Vector3::cross(), Vector3::dot(), Curve< Vector >::link(), Curve< Vector >::nodes(), Vector3::normalize(), Curve< Vector >::resample(), Vector3::rotPtAroundAxis(), and Curve< Vector >::unlink().

Referenced by SoKnot::setKnot(), and SoKnot::updateMesh().

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

Referenced by SoKnot::computeBBox().

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

Returns the center of mass of the tubular mesh.

Reimplemented from Curve< Vector >.

Referenced by SoKnot::computeBBox().

template<class Vector>
void Tube< 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 Curve< Vector >::_Closed, Curve< Vector >::begin(), Curve< Vector >::end(), and Curve< Vector >::nodes().


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