SmallChange  1.0.0
A collection of extensions to Coin3D
Loading...
Searching...
No Matches
SoTCBCurve Class Reference

The SoTCBCurve class is a node for representing smooth curves. More...

#include <Inventor/nodes/SoTCBCurve.h>

Inheritance diagram for SoTCBCurve:
SoShape

Public Member Functions

 SoTCBCurve (void)
 
int getLinesPerSegment (void)
 

Static Public Member Functions

static void initClass (void)
 
static void TCB (const SbVec3f *vec, const SoMFTime &timestamp, const int numControlpoints, const SbTime time, SbVec3f &res)
 

Public Attributes

SoSFInt32 numControlpoints
 
SoMFTime timestamp
 

Protected Member Functions

virtual ~SoTCBCurve ()
 
virtual void computeBBox (SoAction *action, SbBox3f &box, SbVec3f &center)
 
virtual void generatePrimitives (SoAction *action)
 
virtual void GLRender (SoGLRenderAction *action)
 

Detailed Description

The SoTCBCurve class is a node for representing smooth curves.

The TCB-type curve guarantees that all control points are touched by the curve. If no timestamps are specified, all time intervals are set to equal length. Coordinates are read from the state.

Note that the list of timestamps must be sorted in increasing order.

Example usage:

#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <SmallChange/nodes/SoTCBCurve.h>
#include <Inventor/nodes/SoCoordinate3.h>
#include <Inventor/nodes/SoSeparator.h>
int
main(int argc, char* argv[])
{
QWidget * mainwin = SoQt::init(argv[0]);
SoTCBCurve::initClass();
SoSeparator * root = new SoSeparator;
root->ref();
const SbVec3f coordset[] = {
SbVec3f(0, 0, 0),
SbVec3f(1, 1, 0),
SbVec3f(2, 0, 0),
SbVec3f(3, -1, 0),
SbVec3f(4, 0, 0)
};
SoCoordinate3 * coords = new SoCoordinate3;
coords->point.setValues(0, sizeof(coordset) / sizeof(coordset[0]), coordset);
root->addChild(coords);
curve->numControlpoints = coords->point.getNum();
// XXX this should really have been unnecessary, but due to a bug in
// SoTCBCurve vs spec... XXX
#if 1
for (int i=0; i < coords->point.getNum(); i++) {
curve->timestamp.set1Value(i, SbTime((double)i));
}
#endif
root->addChild(curve);
viewer->setSceneGraph(root);
SoQt::show(mainwin);
SoQt::mainLoop();
delete viewer;
root->unref();
return 0;
}
Definition misc/SbList.h:69
The SoTCBCurve class is a node for representing smooth curves.
Definition SoTCBCurve.h:44
SoTCBCurve(void)
Definition SoTCBCurve.cpp:167

Constructor & Destructor Documentation

◆ SoTCBCurve()

SoTCBCurve::SoTCBCurve ( void )

Constructor.

◆ ~SoTCBCurve()

SoTCBCurve::~SoTCBCurve ( )
protectedvirtual

Destructor.

Member Function Documentation

◆ getLinesPerSegment()

int SoTCBCurve::getLinesPerSegment ( void )

Returns an integer with the number of lines per segment rendered at the previous pass.

◆ TCB()

void SoTCBCurve::TCB ( const SbVec3f * vec,
const SoMFTime & timestamp,
const int numControlpoints,
const SbTime time,
SbVec3f & res )
static

Static function to interpolate values along a curve.

This function is based on the Lightwave SDK (ftp.newtek.com) and calculates a TCB-type curve. Code for handling continuity / tension / bias is removed (values = 1). Quite ironic as this is how the curve got its name. :) The timestamp table must be sorted in increasing order. Time values specified outside the range of timestamps will be clipped to the nearest value.

This function is totally independent of the rest of the class, and may be used for general curve calculations.

Member Data Documentation

◆ numControlpoints

SoSFInt32 SoTCBCurve::numControlpoints

Number of control points to use in this NURBS curve.

◆ timestamp

SoMFTime SoTCBCurve::timestamp

The timestamps for the curve. This table must contain either 0 elements or exactly numControlpoints elements. Nothing in between. This list must be sorted in increasing order.


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