.TH "SoCalculator" 3 "Tue Dec 26 2023 17:59:22" "Version 4.0.2" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SoCalculator \- General purpose calculator for floats and 3D float vectors\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBSoEngine\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBvirtual\fP \fBSoType\fP \fBgetTypeId\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBconst\fP \fBSoFieldData\fP * \fBgetFieldData\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBconst\fP \fBSoEngineOutputData\fP * \fBgetOutputData\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBSoCalculator\fP (\fBvoid\fP)" .br .in -1c Public Member Functions inherited from \fBSoEngine\fP .in +1c .ti -1c .RI "\fBvoid\fP \fBevaluateWrapper\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvirtual\fP int \fBgetOutputs\fP (\fBSoEngineOutputList\fP &\fBl\fP) \fBconst\fP" .br .ti -1c .RI "\fBSoEngineOutput\fP * \fBgetOutput\fP (\fBconst\fP \fBSbName\fP &\fBoutputname\fP) \fBconst\fP" .br .ti -1c .RI "SbBool \fBgetOutputName\fP (\fBconst\fP \fBSoEngineOutput\fP *output, \fBSbName\fP &\fBoutputname\fP) \fBconst\fP" .br .ti -1c .RI "SbBool \fBisNotifying\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBnotify\fP (\fBSoNotList\fP *\fBnl\fP)" .br .ti -1c .RI "\fBSoEngine\fP * \fBcopy\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBSoFieldContainer\fP * \fBcopyThroughConnection\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "SbBool \fBshouldCopy\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBwriteInstance\fP (\fBSoOutput\fP *\fBout\fP)" .br .in -1c Public Member Functions inherited from \fBSoFieldContainer\fP .in +1c .ti -1c .RI "\fBvoid\fP \fBsetToDefaults\fP (\fBvoid\fP)" .br .ti -1c .RI "SbBool \fBhasDefaultValues\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "SbBool \fBfieldsAreEqual\fP (\fBconst\fP \fBSoFieldContainer\fP *container) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBcopyFieldValues\fP (\fBconst\fP \fBSoFieldContainer\fP *container, SbBool \fBcopyconnections\fP=FALSE)" .br .ti -1c .RI "SbBool \fBset\fP (\fBconst\fP char *\fBconst\fP fielddata)" .br .ti -1c .RI "\fBvoid\fP \fBget\fP (\fBSbString\fP &fielddata)" .br .ti -1c .RI "\fBvirtual\fP int \fBgetFields\fP (\fBSoFieldList\fP &\fBl\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP int \fBgetAllFields\fP (\fBSoFieldList\fP &\fBl\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBSoField\fP * \fBgetField\fP (\fBconst\fP \fBSbName\fP &name) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBSoField\fP * \fBgetEventIn\fP (\fBconst\fP \fBSbName\fP &name) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBSoField\fP * \fBgetEventOut\fP (\fBconst\fP \fBSbName\fP &name) \fBconst\fP" .br .ti -1c .RI "SbBool \fBgetFieldName\fP (\fBconst\fP \fBSoField\fP *\fBconst\fP \fBfield\fP, \fBSbName\fP &name) \fBconst\fP" .br .ti -1c .RI "SbBool \fBenableNotify\fP (\fBconst\fP SbBool \fBflag\fP)" .br .ti -1c .RI "SbBool \fBisNotifyEnabled\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "SbBool \fBset\fP (\fBconst\fP char *fielddata, \fBSoInput\fP *input)" .br .ti -1c .RI "\fBvoid\fP \fBget\fP (\fBSbString\fP &fielddata, \fBSoOutput\fP *\fBout\fP)" .br .ti -1c .RI "\fBvirtual\fP SbBool \fBvalidateNewFieldValue\fP (\fBSoField\fP *\fBfield\fP, \fBvoid\fP *\fBnewval\fP)" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBaddWriteReference\fP (\fBSoOutput\fP *\fBout\fP, SbBool \fBisfromfield\fP=FALSE)" .br .ti -1c .RI "SbBool \fBgetIsBuiltIn\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBcopyContents\fP (\fBconst\fP \fBSoFieldContainer\fP *from, SbBool \fBcopyconnections\fP)" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBgetFieldsMemorySize\fP (size_t &\fBmanaged\fP, size_t &\fBunmanaged\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBsetUserData\fP (\fBvoid\fP *userdata) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP * \fBgetUserData\fP (\fBvoid\fP) \fBconst\fP" .br .in -1c Public Member Functions inherited from \fBSoBase\fP .in +1c .ti -1c .RI "\fBvoid\fP \fBref\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBunref\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBunrefNoDelete\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "int32_t \fBgetRefCount\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBtouch\fP (\fBvoid\fP)" .br .ti -1c .RI "SbBool \fBisOfType\fP (\fBSoType\fP type) \fBconst\fP" .br .RI "Returns \fCTRUE\fP if the type of this object is either of the same type or inherited from \fItype\fP\&. " .ti -1c .RI "\fBvirtual\fP \fBSbName\fP \fBgetName\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBsetName\fP (\fBconst\fP \fBSbName\fP &\fBnewname\fP)" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBstartNotify\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvoid\fP \fBaddAuditor\fP (\fBvoid\fP *\fBconst\fP \fBauditor\fP, \fBconst\fP \fBSoNotRec::Type\fP type)" .br .ti -1c .RI "\fBvoid\fP \fBremoveAuditor\fP (\fBvoid\fP *\fBconst\fP \fBauditor\fP, \fBconst\fP \fBSoNotRec::Type\fP type)" .br .ti -1c .RI "\fBconst\fP \fBSoAuditorList\fP & \fBgetAuditors\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "SbBool \fBshouldWrite\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvoid\fP \fBassertAlive\fP (\fBvoid\fP) \fBconst\fP" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "\fBstatic\fP \fBSoType\fP \fBgetClassTypeId\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP * \fBcreateInstance\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitClass\fP (\fBvoid\fP)" .br .RI "Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system\&. " .in -1c Static Public Member Functions inherited from \fBSoEngine\fP .in +1c .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitClass\fP (\fBvoid\fP)" .br .RI "Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system\&. " .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitClasses\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBSoType\fP \fBgetClassTypeId\fP (\fBvoid\fP)" .br .RI "This static method returns the \fBSoType\fP object associated with objects of this class\&. " .ti -1c .RI "\fBstatic\fP \fBSoEngine\fP * \fBgetByName\fP (\fBconst\fP \fBSbName\fP &name)" .br .ti -1c .RI "\fBstatic\fP int \fBgetByName\fP (\fBconst\fP \fBSbName\fP &name, \fBSoEngineList\fP &\fBel\fP)" .br .in -1c Static Public Member Functions inherited from \fBSoFieldContainer\fP .in +1c .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitClass\fP (\fBvoid\fP)" .br .RI "Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system\&. " .ti -1c .RI "\fBstatic\fP \fBSoType\fP \fBgetClassTypeId\fP (\fBvoid\fP)" .br .RI "This static method returns the \fBSoType\fP object associated with objects of this class\&. " .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBcleanupClass\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitCopyDict\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBaddCopy\fP (\fBconst\fP \fBSoFieldContainer\fP *\fBorig\fP, \fBconst\fP \fBSoFieldContainer\fP *copy)" .br .ti -1c .RI "\fBstatic\fP \fBSoFieldContainer\fP * \fBcheckCopy\fP (\fBconst\fP \fBSoFieldContainer\fP *\fBorig\fP)" .br .ti -1c .RI "\fBstatic\fP \fBSoFieldContainer\fP * \fBfindCopy\fP (\fBconst\fP \fBSoFieldContainer\fP *\fBorig\fP, \fBconst\fP SbBool \fBcopyconnections\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBcopyDone\fP (\fBvoid\fP)" .br .in -1c Static Public Member Functions inherited from \fBSoBase\fP .in +1c .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBinitClass\fP (\fBvoid\fP)" .br .RI "Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system\&. " .ti -1c .RI "\fBstatic\fP \fBSoType\fP \fBgetClassTypeId\fP (\fBvoid\fP)" .br .RI "This static method returns the \fBSoType\fP object associated with objects of this class\&. " .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBaddName\fP (\fBSoBase\fP *\fBconst\fP base, \fBconst\fP char *\fBconst\fP name)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBremoveName\fP (\fBSoBase\fP *\fBconst\fP base, \fBconst\fP char *\fBconst\fP name)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBincrementCurrentWriteCounter\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBdecrementCurrentWriteCounter\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBSoBase\fP * \fBgetNamedBase\fP (\fBconst\fP \fBSbName\fP &name, \fBSoType\fP type)" .br .ti -1c .RI "\fBstatic\fP int \fBgetNamedBases\fP (\fBconst\fP \fBSbName\fP &name, \fBSoBaseList\fP &\fBbaselist\fP, \fBSoType\fP type)" .br .ti -1c .RI "\fBstatic\fP SbBool \fBread\fP (\fBSoInput\fP *input, \fBSoBase\fP *&base, \fBSoType\fP \fBexpectedtype\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBsetInstancePrefix\fP (\fBconst\fP \fBSbString\fP &c)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBsetTraceRefs\fP (SbBool \fBtrace\fP)" .br .ti -1c .RI "\fBstatic\fP SbBool \fBgetTraceRefs\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP SbBool \fBconnectRoute\fP (\fBSoInput\fP *input, \fBconst\fP \fBSbName\fP &\fBfromnodename\fP, \fBconst\fP \fBSbName\fP &\fBfromfieldname\fP, \fBconst\fP \fBSbName\fP &\fBtonodename\fP, \fBconst\fP \fBSbName\fP &\fBtofieldname\fP)" .br .ti -1c .RI "\fBstatic\fP SbBool \fBreadRoute\fP (\fBSoInput\fP *input)" .br .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "\fBSoMFFloat\fP \fBa\fP" .br .ti -1c .RI "\fBSoMFFloat\fP \fBb\fP" .br .ti -1c .RI "\fBSoMFFloat\fP \fBc\fP" .br .ti -1c .RI "\fBSoMFFloat\fP \fBd\fP" .br .ti -1c .RI "\fBSoMFFloat\fP \fBe\fP" .br .ti -1c .RI "\fBSoMFFloat\fP \fBf\fP" .br .ti -1c .RI "\fBSoMFFloat\fP \fBg\fP" .br .ti -1c .RI "\fBSoMFFloat\fP \fBh\fP" .br .ti -1c .RI "\fBSoMFVec3f\fP \fBA\fP" .br .ti -1c .RI "\fBSoMFVec3f\fP \fBB\fP" .br .ti -1c .RI "\fBSoMFVec3f\fP \fBC\fP" .br .ti -1c .RI "\fBSoMFVec3f\fP \fBD\fP" .br .ti -1c .RI "\fBSoMFVec3f\fP \fBE\fP" .br .ti -1c .RI "\fBSoMFVec3f\fP \fBF\fP" .br .ti -1c .RI "\fBSoMFVec3f\fP \fBG\fP" .br .ti -1c .RI "\fBSoMFVec3f\fP \fBH\fP" .br .ti -1c .RI "\fBSoMFString\fP \fBexpression\fP" .br .ti -1c .RI "\fBSoEngineOutput\fP \fBoa\fP" .br .ti -1c .RI "\fBSoEngineOutput\fP \fBob\fP" .br .ti -1c .RI "\fBSoEngineOutput\fP \fBoc\fP" .br .ti -1c .RI "\fBSoEngineOutput\fP \fBod\fP" .br .ti -1c .RI "\fBSoEngineOutput\fP \fBoA\fP" .br .ti -1c .RI "\fBSoEngineOutput\fP \fBoB\fP" .br .ti -1c .RI "\fBSoEngineOutput\fP \fBoC\fP" .br .ti -1c .RI "\fBSoEngineOutput\fP \fBoD\fP" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "\fBvirtual\fP \fB~SoCalculator\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvirtual\fP \fBvoid\fP \fBinputChanged\fP (\fBSoField\fP *\fBwhich\fP)" .br .in -1c Protected Member Functions inherited from \fBSoEngine\fP .in +1c .ti -1c .RI "\fBSoEngine\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvirtual\fP \fB~SoEngine\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvirtual\fP SbBool \fBreadInstance\fP (\fBSoInput\fP *\fBin\fP, \fBunsigned\fP short flags)" .br .ti -1c .RI "\fBvoid\fP \fBwriteOutputTypes\fP (\fBSoOutput\fP *\fBout\fP)" .br .in -1c Protected Member Functions inherited from \fBSoFieldContainer\fP .in +1c .ti -1c .RI "\fBSoFieldContainer\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvirtual\fP \fB~SoFieldContainer\fP ()" .br .in -1c Protected Member Functions inherited from \fBSoBase\fP .in +1c .ti -1c .RI "\fBSoBase\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvirtual\fP \fB~SoBase\fP ()" .br .ti -1c .RI "SbBool \fBhasMultipleWriteRefs\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "SbBool \fBwriteHeader\fP (\fBSoOutput\fP *\fBout\fP, SbBool \fBisgroup\fP, SbBool \fBisengine\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBwriteFooter\fP (\fBSoOutput\fP *\fBout\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBconst\fP char * \fBgetFileFormatName\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvirtual\fP \fBSoNotRec\fP \fBcreateNotRec\fP (\fBvoid\fP)" .br .in -1c .SS "Static Protected Member Functions" .in +1c .ti -1c .RI "\fBstatic\fP \fBconst\fP \fBSoFieldData\fP ** \fBgetInputDataPtr\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBconst\fP \fBSoEngineOutputData\fP ** \fBgetOutputDataPtr\fP (\fBvoid\fP)" .br .in -1c Static Protected Member Functions inherited from \fBSoEngine\fP .in +1c .ti -1c .RI "\fBstatic\fP \fBconst\fP \fBSoFieldData\fP ** \fBgetInputDataPtr\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBconst\fP \fBSoEngineOutputData\fP ** \fBgetOutputDataPtr\fP (\fBvoid\fP)" .br .in -1c Static Protected Member Functions inherited from \fBSoBase\fP .in +1c .ti -1c .RI "\fBstatic\fP uint32_t \fBgetCurrentWriteCounter\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBstaticDataLock\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBstatic\fP \fBvoid\fP \fBstaticDataUnlock\fP (\fBvoid\fP)" .br .in -1c .SS "Additional Inherited Members" Protected Types inherited from \fBSoBase\fP .in +1c .ti -1c .RI "enum \fBBaseFlags\fP { \fBIS_ENGINE\fP = 0x01, \fBIS_GROUP\fP = 0x02 }" .br .in -1c Protected Attributes inherited from \fBSoFieldContainer\fP .in +1c .ti -1c .RI "SbBool \fBisBuiltIn\fP" .br .in -1c .SH "Detailed Description" .PP General purpose calculator for floats and 3D float vectors\&. The \fBSoCalculator\fP uses the values from the input fields (which are either single floating point values or vectors) as variables in the free-form engine expressions and places the results on the output fields\&. .PP The engine has sixteen input fields; eight scalar inputs (\fIa\fP, \fIb\fP, \fIc\fP, \fId\fP, \fIe\fP, \fIf\fP, \fIg\fP, and \fIh\fP), and eight vector inputs (\fIA\fP, \fIB\fP, \fIC\fP, \fID\fP, \fIE\fP, \fIF\fP, \fIG\fP, and \fIH\fP)\&. .PP There are eight output fields; four scalar outputs (\fIoa\fP, \fIob\fP, \fIoc\fP, and \fIod\fP), and four vector outputs (\fIoA\fP, \fIoB\fP, \fIoC\fP, and \fIoD\fP)\&. .PP The expression syntax is quite similar to C/C++, with a very limited set of keywords and functions\&. .PP An example: .PP .PP .nf oa = a * (0\&.5 + b) / c .fi .PP .PP Will multiply the value in \fIa\fP with the value in \fIb\fP plus \fB0\&.5\fP, divide that result with \fIc\fP, and place the result in \fIoa\fP\&. Since this is an engine, the expression will only be evaluated when someone attempts to read the value in \fIoa\fP, not every time an input in changed\&. .PP All inputs are multi-fields, and if there are several values in an input, the expression will be evaluated once for every input field value, and the output will create as many values as there are input field values\&. .PP If there is more than one input field, and the input fields do not have the same number of values, the engine will create as many output values as the input field with the biggest number of values\&. When the index get out of bounds for some other input field, the last field value will be used\&. .PP Vector expressions are similar to scalar expression\&. An example: .PP .PP .nf oA = A + vec3f(1\&.0, 0\&.0, 0\&.0) * B .fi .PP .PP Will take the vector in \fIA\fP, add the value in \fIB\fP multiplied with (1,0,0), and place the result in \fIoA\fP\&. .PP In addition to regular arithmetics, the \fBSoCalculator\fP syntax also includes some functions\&. .PP Scalar functions: .PP .PD 0 .IP "\(bu" 1 cos(x) - cosine function (x in radians) .IP "\(bu" 1 sin(x) - sinus function .IP "\(bu" 1 tan(x) - tangent function .IP "\(bu" 1 acos(x) - arc cosine function .IP "\(bu" 1 asin(x) - arc sinus function .IP "\(bu" 1 atan(x) - arc tangent function .IP "\(bu" 1 atan2(y, x) - arc tangent function of two variables (y, x)\&. .IP "\(bu" 1 cosh(x) - hyperbolic cosine function .IP "\(bu" 1 sinh(x) - hyperbolic sinus function .IP "\(bu" 1 tanh(x) - hyperbolic tangent function .IP "\(bu" 1 sqrt(x) - square root function .IP "\(bu" 1 pow(x,y) - x raised to the power of y .IP "\(bu" 1 exp(x) - e to the power of x .IP "\(bu" 1 log(x) - natural logarithm of x .IP "\(bu" 1 log10() - base-10 logarithm of x .IP "\(bu" 1 ceil(x) - rounds x upwards to the nearest integer .IP "\(bu" 1 floor(x) - rounds x downwards to the nearest integer .IP "\(bu" 1 fabs(x) - absolute value .IP "\(bu" 1 fmod(x, y) - remainder of dividing x by y .IP "\(bu" 1 rand(x) - pseudo-random value between 0 and 1 .PP Vector functions: .PP .PD 0 .IP "\(bu" 1 cross(x, y) - cross product of x and y .IP "\(bu" 1 dot(x,y) - dot product of x and y (returns scalar value) .IP "\(bu" 1 length(x) - length of x (returns scalar value) .IP "\(bu" 1 normalize(x) - returns normalized version of x .IP "\(bu" 1 x[y] - access components in x (y should be a scalar value in the range [0,2]) .PP There are also some named constants that can be used: .PP .PD 0 .IP "\(bu" 1 MAXFLOAT .IP "\(bu" 1 MINFLOAT .IP "\(bu" 1 M_E .IP "\(bu" 1 M_LOG2E .IP "\(bu" 1 M_LOG10E .IP "\(bu" 1 M_LN2 .IP "\(bu" 1 M_PI .IP "\(bu" 1 M_SQRT2 - sqrt(2) .IP "\(bu" 1 M_SQRT1_2 - sqrt(1/2) .PP The only control flow available is the \fI\fP? operator\&. An example: .PP .PP .nf oa = (a > b) ? (a * 0\&.5) : (b * c) .fi .PP .PP (The parentheses are not necessary, they're there just to make the example easier to read) .PP In addition to the standard comparison operators (\fI<\fP, \fI>\fP, \fI<=\fP, \fI>=\fP, \fI==\fP, \fI!=\fP), you can also use && (AND) and || (OR) to combine expression, and the unary ! (NOT) operator\&. .PP One final thing worth mentioning are the temporary variables\&. There exist sixteen temporary variables that can be used in expressions\&. \fIta\fP, \fItb\fP, \fItc\fP, \fItd\fP, \fIte\fP, \fItf\fP, \fItg\fP, and \fIth\fP are scalar variables, and \fItA\fP, \fItB\fP, \fItC\fP, \fItD\fP, \fItE\fP, \fItF\fP, \fItG\fP, and \fItH\fP are vector variables\&. They are usually used when you have more than one expression that should be evaluated in order\&. .PP An example with three expressions: .PP .PP .nf ta = a * b; tb = c + d; tc = e \- f tA = vec3f(ta, tb, tc) + A oA = tA * B .fi .PP .PP The example just shows how temporary variables can be used to make your expressions easier to read\&. Please note that it's possible to have several statements in one expression\&. You just separate them with semicolons\&. .PP Here is a simple example of how an \fBSoCalculator\fP engine may be used in an \&.iv file: .PP .PP .nf DEF mycamera PerspectiveCamera { orientation 1 0 0 1\&.57 } DEF headlight DirectionalLight { intensity 0\&.8 direction 0 0 1 } Separator { # Render a cube not affected by lighting LightModel { model BASE_COLOR } BaseColor { rgb = Calculator { a = USE headlight \&. intensity expression [ "oA = vec3f( a, a, a)" ] } \&. oA } Cube {} } .fi .PP .PP In the example, the color of the Cube is a function of the intensity of the DirectionalLight, even though the Cube is rendered without lighting because of the BASE_COLOR LightModel\&. .SH "Constructor & Destructor Documentation" .PP .SS "SoCalculator::SoCalculator (\fBvoid\fP)" Constructor\&. .SS "SoCalculator::~SoCalculator (\fBvoid\fP)\fC [protected]\fP, \fC [virtual]\fP" Destructor\&. .SH "Member Function Documentation" .PP .SS "\fBSoType\fP SoCalculator::getClassTypeId (\fBvoid\fP)\fC [static]\fP" This static method returns the \fBSoType\fP object associated with objects of this class\&. .br .SS "\fBSoType\fP SoCalculator::getTypeId (\fBvoid\fP) const\fC [virtual]\fP" Returns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for runtime type checking and 'downward' casting\&. .br .PP Implements \fBSoBase\fP\&. .SS "\fBconst\fP \fBSoFieldData\fP ** SoCalculator::getInputDataPtr (\fBvoid\fP)\fC [static]\fP, \fC [protected]\fP" Returns the \fBSoFieldData\fP class which holds information about inputs in this engine\&. .br .SS "\fBconst\fP \fBSoEngineOutputData\fP ** SoCalculator::getOutputDataPtr (\fBvoid\fP)\fC [static]\fP, \fC [protected]\fP" Returns the \fBSoEngineOutputData\fP class which holds information about the outputs in this engine\&. .br .SS "\fBconst\fP \fBSoFieldData\fP * SoCalculator::getFieldData (\fBvoid\fP) const\fC [virtual]\fP" Returns the \fBSoFieldData\fP class which holds information about inputs in this engine\&. .br .PP Reimplemented from \fBSoFieldContainer\fP\&. .SS "\fBconst\fP \fBSoEngineOutputData\fP * SoCalculator::getOutputData (\fBvoid\fP) const\fC [virtual]\fP" Returns the \fBSoEngineOutputData\fP class which holds information about the outputs in this engine\&. .br .PP Implements \fBSoEngine\fP\&. .SS "\fBvoid\fP * SoCalculator::createInstance (\fBvoid\fP)\fC [static]\fP" Creates a new instance of the class type corresponding to the \fBSoType\fP object\&. .br .SS "\fBvoid\fP SoCalculator::inputChanged (\fBSoField\fP * which)\fC [protected]\fP, \fC [virtual]\fP" Called when an input is changed\&. The default method does nothing, but subclasses may override this method to do The Right Thing when a specific field is changed\&. .PP Reimplemented from \fBSoEngine\fP\&. .SH "Member Data Documentation" .PP .SS "\fBSoMFFloat\fP SoCalculator::a" Input floating point value for the expressions\&. .SS "\fBSoMFFloat\fP SoCalculator::b" Input floating point value for the expressions\&. .SS "\fBSoMFFloat\fP SoCalculator::c" Input floating point value for the expressions\&. .SS "\fBSoMFFloat\fP SoCalculator::d" Input floating point value for the expressions\&. .SS "\fBSoMFFloat\fP SoCalculator::e" Input floating point value for the expressions\&. .SS "\fBSoMFFloat\fP SoCalculator::f" Input floating point value for the expressions\&. .SS "\fBSoMFFloat\fP SoCalculator::g" Input floating point value for the expressions\&. .SS "\fBSoMFFloat\fP SoCalculator::h" Input floating point value for the expressions\&. .SS "\fBSoMFVec3f\fP SoCalculator::A" Input vector with three floating point values for the expressions\&. .SS "\fBSoMFVec3f\fP SoCalculator::B" Input vector with three floating point values for the expressions\&. .SS "\fBSoMFVec3f\fP SoCalculator::C" Input vector with three floating point values for the expressions\&. .SS "\fBSoMFVec3f\fP SoCalculator::D" Input vector with three floating point values for the expressions\&. .SS "\fBSoMFVec3f\fP SoCalculator::E" Input vector with three floating point values for the expressions\&. .SS "\fBSoMFVec3f\fP SoCalculator::F" Input vector with three floating point values for the expressions\&. .SS "\fBSoMFVec3f\fP SoCalculator::G" Input vector with three floating point values for the expressions\&. .SS "\fBSoMFVec3f\fP SoCalculator::H" Input vector with three floating point values for the expressions\&. .SS "\fBSoMFString\fP SoCalculator::expression" Mathematical expressions for the calculator\&. .SS "\fBSoEngineOutput\fP SoCalculator::oa" (\fBSoMFFloat\fP) Output value with result from the calculations\&. .SS "\fBSoEngineOutput\fP SoCalculator::ob" (\fBSoMFFloat\fP) Output value with result from the calculations\&. .SS "\fBSoEngineOutput\fP SoCalculator::oc" (\fBSoMFFloat\fP) Output value with result from the calculations\&. .SS "\fBSoEngineOutput\fP SoCalculator::od" (\fBSoMFFloat\fP) Output value with result from the calculations\&. .SS "\fBSoEngineOutput\fP SoCalculator::oA" (\fBSoMFVec3f\fP) Output value with result from the calculations\&. .SS "\fBSoEngineOutput\fP SoCalculator::oB" (\fBSoMFVec3f\fP) Output value with result from the calculations\&. .SS "\fBSoEngineOutput\fP SoCalculator::oC" (\fBSoMFVec3f\fP) Output value with result from the calculations\&. .SS "\fBSoEngineOutput\fP SoCalculator::oD" (\fBSoMFVec3f\fP) Output value with result from the calculations\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.