6.5. Implementing an evaluate() Method

The evaluate() method is responsible for taking the input values and producing output values. The input values are read using the standard field getValue() routines. You can use the SO_ENGINE_OUTPUT() macro to set the values in the engine's outputs.

SO_ENGINE_OUTPUT() is used for setting values in outputs. Do not perform any calculation inside this macro. Side effects are not allowed, because this macro loops through each connection. You can, however, call SO_ENGINE_OUTPUT() multiple times, once for each output, as shown in the SoComposeVec2f SoComposeVec2f SoComposeVec2f class (Examples 6-3 and 6-4).