What is it?
A subclass of the Open Inventor SoEngine class used for computing
the values of a function on a uniformly spaced regular grid.
How to use it
Once the source code
has been downloaded and compiled, the engine can be used.
The engine has 6 different input fields for computing a scalar field.
- xDim, the number of points in the x direction.
- yDim, the number of points in the y direction.
- zDim, the number of points in the z direction.
- minBounds, the minimum value of the grid.
- maxBounds, the maximum value of the grid.
- expression, the mathematical expression to be solved (must be a
valid function computable by the SoCalculator engine).
The output of the engine is an SFScalarField.
The following piece of code will create a ScalarArithmitic engine.
// create pointer to object
ScalarArithmitic *arith = new ScalarArithmitic();
// set the inputs
arith->xDim.setValue(10.0);
arith->yDim.setValue(10.0);
arith->zDim.setValue(10.0);
arith->minBounds.setValue(-1.0, -1.0, -1.0);
arith->maxBounds.setValue( 1.0, 1.0, 1.0);
// evaluate the equation of a sphere
arith->expression.setValue("x*x + y*y + z*z");
// connect the output to an existing SFScalarField
sfield->connectFrom(&arith->scalarField);
Before creating an object of type ScalarArithmitic it must be
initialized. Add ScalarArithmitic::initClass() to the main() routine of your
program after the database has been initialized with either
SoDB::init() or SoXt::init().
|