[vtk-developers] Hierarchy for vtkFunctionParser
David Gobbi
dgobbi at irus.rri.on.ca
Tue Feb 27 12:17:24 EST 2001
Hi Amy,
I've written a class called vtkProgrammableFunction that has the same
interface as vtkFunctionParser, except that its 'SetFunction' method
accepts a C function (or tcl, python, java function) instead
of a text string. An example follows:
//-----------
void xSquared(void *userData)
{
vtkProgrammableFunction *func = (vtkProgrammableFunction *)userData;
// get the variable values
x = func->GetScalarVariableValue('x')
// set the result
func->SetScalarResult(x*x);
}
vtkProgrammableFunction *func = vtkProgrammableFunction::New();
func->SetFunction(xSquared,func);
func->SetFunctionArgDelete(NULL);
//----------
So, I was considering creating the following hierarchy:
vtkAbstractFunction (the base class)
/ \
vtkFunctionParser vtkProgrammableFunction
and perhaps renaming 'vtkFunctionParser' to 'vtkParsedFunction'
in keeping with VTK naming conventions for derived classes.
Any objections/suggestions? My thoughts are that these 'vtkFunctions'
could be a very useful for programmable image operations (like
vtkImageMathematics but more flexible), for programmable warp transforms,
etc.
- David
--
David Gobbi, MSc dgobbi at irus.rri.on.ca
Advanced Imaging Research Group
Robarts Research Institute, University of Western Ontario
More information about the vtk-developers
mailing list