VHTK::PiecewiseFunction Class Reference
[Volumetric Data Nodes]

Inheritance diagram for VHTK::PiecewiseFunction:

Inheritance graph
[legend]

List of all members.


Detailed Description

A piecewise linear transfer function implementation.

The segments are by default specified as ( X1a Y1a, X1b Y1b, X2a Y2a, X2b, ... ), i e pairs of Vec2f to specify start position, start value, stop position and stop value. For a color transfer function each value must be in the interval (0,1), since it is to be converted to unsigned char which would yield under/overflow for other values.

tf_piecewise1.png

The segments are also assumed to be specified in ascending order. If they are not the result is likely to be unpredictable and wrong.

If the field continuous is true the segments are specified as ( X1 Y1, X2 Y2, X3 Y3, ... ), which produces a continuous function with piecewise linear segments between the points specified. The points must be specified in the order of the X value.

tf_piecewise2.png

Updating the segments field will generate an event, but not updating the continuous field, so to change the function from non continuous to continuous change first the continuous field and then set the segments field to match.

X3D Interface

 NameTypeDefault valueDescription
segments MFVec2f   []    
continuous SFBool   FALSE   This flag makes it easier to specify a continuous function, see the detailed description  
 
Derived from VHTKTransferFunctionNode  
input SFFloat   0.0   The input to convert using this transfer function.  
outputValue (SFFloat)   0.0   This field converts the input value to a output value according to the specifications for the transfer function.  
outputDerivative (SFFloat)   0.0   This field evaluates the derivative of the transfer function at the position of the input value.  

Public Member Functions

 PiecewiseFunction ()
 Initializes local members.
 PiecewiseFunction (H3D::Vec2f p0, H3D::Vec2f p1)
 Initializes local members with one segment.
 PiecewiseFunction (H3D::H3DFloat x1, H3D::H3DFloat y1, H3D::H3DFloat x2, H3D::H3DFloat y2)
 Initializes local members with one segment.
H3D::H3DFloat get (H3D::H3DFloat x)
 Get the value as float.
H3D::H3DFloat getDerivative (H3D::H3DFloat x)
 Get the derivative.

Public Attributes

auto_ptr
< H3D::ThreadSafeSField
< H3D::SFBool > > 
continuous
auto_ptr
< H3D::ThreadSafeMField
< H3D::MFVec2f > > 
segments
 The segments of this function.

Static Public Attributes

static H3D::H3DNodeDatabase database


Constructor & Destructor Documentation

VHTK::PiecewiseFunction::PiecewiseFunction (  ) 

Initializes local members.

VHTK::PiecewiseFunction::PiecewiseFunction ( H3D::Vec2f  p0,
H3D::Vec2f  p1 
)

Initializes local members with one segment.

VHTK::PiecewiseFunction::PiecewiseFunction ( H3D::H3DFloat  x1,
H3D::H3DFloat  y1,
H3D::H3DFloat  x2,
H3D::H3DFloat  y2 
)

Initializes local members with one segment.

Deprecated:
This function became deprecated when the segments type changed from MFFloat to MFVec2f.


Member Function Documentation

H3D::H3DFloat VHTK::PiecewiseFunction::get ( H3D::H3DFloat  x  )  [virtual]

Get the value as float.

Implements VHTK::VHTKTransferFunctionNode.

H3D::H3DFloat VHTK::PiecewiseFunction::getDerivative ( H3D::H3DFloat  x  )  [virtual]

Get the derivative.

Reimplemented from VHTK::VHTKTransferFunctionNode.


Member Data Documentation

The segments of this function.


Generated on Thu Mar 5 08:46:57 2009 for Volume Haptics Toolkit by  doxygen 1.5.6