SoCalculator(3)
π NAME π
SoCalculator β General purpose calculator for floats and 3D float vectors. That's the whole entire vibe, bestie. It's the engine that does math for you, with floats and 3D float vectors. slay.
β¨ SYNOPSIS β¨
okay so first things first, you gotta include this header, no cap:
#include <Inventor/engines/SoCalculator.h>
Inherits SoEngine.
π Public Member Functions π
virtual SoType getTypeId (void) constβ the type id getter, iconic.virtual const SoFieldData * getFieldData (void) constβ field data pointer, yes bestie.virtual const SoEngineOutputData * getOutputData (void) constβ output data pointer, periodt.SoCalculator (void)β the constructor, main character energy.
π¦ Public Member Functions inherited from SoEngine π¦
void evaluateWrapper (void)β evaluate wrapper, slay.virtual int getOutputs (SoEngineOutputList &l) constβ get the outputs list.SoEngineOutput * getOutput (const SbName &outputname) constβ get one output by name.SbBool getOutputName (const SoEngineOutput *output, SbName &outputname) constβ get the output name.SbBool isNotifying (void) constβ are we notifying? iykyk.virtual void notify (SoNotList *nl)β notify, periodt.SoEngine * copy (void) constβ copy, iconic.virtual SoFieldContainer * copyThroughConnection (void) constβ copy through connection.SbBool shouldCopy (void) constβ should copy?virtual void writeInstance (SoOutput *out)β write instance.
πΈ Public Member Functions inherited from SoFieldContainer πΈ
void setToDefaults (void)β set to defaults.SbBool hasDefaultValues (void) constβ has default values?SbBool fieldsAreEqual (const SoFieldContainer *container) constβ fields are equal?void copyFieldValues (const SoFieldContainer *container, SbBool copyconnections=FALSE)β copy field values.SbBool set (const char *const fielddata)β set from field data.void get (SbString &fielddata)β get field data.virtual int getFields (SoFieldList &l) constβ get fields.virtual int getAllFields (SoFieldList &l) constβ get all fields.virtual SoField * getField (const SbName &name) constβ get field by name.virtual SoField * getEventIn (const SbName &name) constβ get event in by name.virtual SoField * getEventOut (const SbName &name) constβ get event out by name.SbBool getFieldName (const SoField *const field, SbName &name) constβ get field name.SbBool enableNotify (const SbBool flag)β enable notify.SbBool isNotifyEnabled (void) constβ is notify enabled?SbBool set (const char *fielddata, SoInput *input)β set with input.void get (SbString &fielddata, SoOutput *out)β get with output.virtual SbBool validateNewFieldValue (SoField *field, void *newval)β validate new field value.virtual void addWriteReference (SoOutput *out, SbBool isfromfield=FALSE)β add write reference.SbBool getIsBuiltIn (void) constβ get is built in.virtual void copyContents (const SoFieldContainer *from, SbBool copyconnections)β copy contents.virtual void getFieldsMemorySize (size_t &managed, size_t &unmanaged) constβ get fields memory size.void setUserData (void *userdata) constβ set user data.void * getUserData (void) constβ get user data.
π Public Member Functions inherited from SoBase π
void ref (void) constβ ref.void unref (void) constβ unref.void unrefNoDelete (void) constβ unref no delete.int32_t getRefCount (void) constβ get ref count.void touch (void)β touch.SbBool isOfType (SoType type) constβ returnsTRUEif the type of this object is either of the same type or inherited fromtype. periodt.virtual SbName getName (void) constβ get name.virtual void setName (const SbName &newname)β set name.virtual void startNotify (void)β start notify.void addAuditor (void *const auditor, const SoNotRec::Type type)β add auditor.void removeAuditor (void *const auditor, const SoNotRec::Type type)β remove auditor.const SoAuditorList & getAuditors (void) constβ get auditors.SbBool shouldWrite (void)β should write?void assertAlive (void) constβ assert alive.
π Static Public Member Functions π
static SoType getClassTypeId (void)β get class type id.static void * createInstance (void)β create instance.static void initClass (void)β Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.
β Static Public Member Functions inherited from SoEngine β
static void initClass (void)β Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static void initClasses (void)β init classes.static SoType getClassTypeId (void)β This static method returns theSoTypeobject associated with objects of this class.static SoEngine * getByName (const SbName &name)β get by name.static int getByName (const SbName &name, SoEngineList &el)β get by name into list.
π Static Public Member Functions inherited from SoFieldContainer π
static void initClass (void)β Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static SoType getClassTypeId (void)β This static method returns theSoTypeobject associated with objects of this class.static void cleanupClass (void)β cleanup class.static void initCopyDict (void)β init copy dict.static void addCopy (const SoFieldContainer *orig, const SoFieldContainer *copy)β add copy.static SoFieldContainer * checkCopy (const SoFieldContainer *orig)β check copy.static SoFieldContainer * findCopy (const SoFieldContainer *orig, const SbBool copyconnections)β find copy.static void copyDone (void)β copy done.
π Static Public Member Functions inherited from SoBase π
static void initClass (void)β Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.static SoType getClassTypeId (void)β This static method returns theSoTypeobject associated with objects of this class.static void addName (SoBase *const base, const char *const name)β add name.static void removeName (SoBase *const base, const char *const name)β remove name.static void incrementCurrentWriteCounter (void)β increment current write counter.static void decrementCurrentWriteCounter (void)β decrement current write counter.static SoBase * getNamedBase (const SbName &name, SoType type)β get named base.static int getNamedBases (const SbName &name, SoBaseList &baselist, SoType type)β get named bases.static SbBool read (SoInput *input, SoBase *&base, SoType expectedtype)β read.static void setInstancePrefix (const SbString &c)β set instance prefix.static void setTraceRefs (SbBool trace)β set trace refs.static SbBool getTraceRefs (void)β get trace refs.static SbBool connectRoute (SoInput *input, const SbName &fromnodename, const SbName &fromfieldname, const SbName &tonodename, const SbName &tofieldname)β connect route.static SbBool readRoute (SoInput *input)β read route.
π Public Attributes π
SoMFFloat aSoMFFloat bSoMFFloat cSoMFFloat dSoMFFloat eSoMFFloat fSoMFFloat gSoMFFloat hSoMFVec3f ASoMFVec3f BSoMFVec3f CSoMFVec3f DSoMFVec3f ESoMFVec3f FSoMFVec3f GSoMFVec3f HSoMFString expressionSoEngineOutput oaSoEngineOutput obSoEngineOutput ocSoEngineOutput odSoEngineOutput oASoEngineOutput oBSoEngineOutput oCSoEngineOutput oD
π§ Protected Member Functions π§
virtual ~SoCalculator (void)β destructor, bye bestie.virtual void inputChanged (SoField *which)β input changed.
π Protected Member Functions inherited from SoEngine π
SoEngine (void)β constructor.virtual ~SoEngine (void)β destructor.virtual SbBool readInstance (SoInput *in, unsigned short flags)β read instance.void writeOutputTypes (SoOutput *out)β write output types.
π Protected Member Functions inherited from SoFieldContainer π
SoFieldContainer (void)β constructor.virtual ~SoFieldContainer ()β destructor.
π Protected Member Functions inherited from SoBase π
SoBase (void)β constructor.virtual ~SoBase ()β destructor.SbBool hasMultipleWriteRefs (void) constβ has multiple write refs.SbBool writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) constβ write header.void writeFooter (SoOutput *out) constβ write footer.virtual const char * getFileFormatName (void) constβ get file format name.virtual SoNotRec createNotRec (void)β create not rec.
π«Ά Static Protected Member Functions π«Ά
static const SoFieldData ** getInputDataPtr (void)β get input data ptr.static const SoEngineOutputData ** getOutputDataPtr (void)β get output data ptr.
π Static Protected Member Functions inherited from SoEngine π
static const SoFieldData ** getInputDataPtr (void)β get input data ptr.static const SoEngineOutputData ** getOutputDataPtr (void)β get output data ptr.
β¨ Static Protected Member Functions inherited from SoBase β¨
static uint32_t getCurrentWriteCounter (void)β get current write counter.static void staticDataLock (void)β static data lock.static void staticDataUnlock (void)β static data unlock.
π Additional Inherited Members π
Protected Types inherited from SoBase
enum BaseFlags { IS_ENGINE = 0x01, IS_GROUP = 0x02 }β the base flags, iykyk.
Protected Attributes inherited from SoFieldContainer
SbBool isBuiltInβ protected attribute, slay.
β¨ Detailed Description β¨
Okay bestie, listen β this is a general purpose calculator, but make it β¨extraβ¨. It does floats and 3D float vectors. Both. At the same time. Main character energy fr fr.
Here's the whole vibe: SoCalculator takes the values sitting in its input fields (each one is either a single floating point value or a vector) and uses them as variables in free-form engine expressions, then drops the results onto the output fields. That's it. That's the whole thing. π
The engine has sixteen input fields:
- eight scalar inputs:
a,b,c,d,e,f,g, andh - eight vector inputs:
A,B,C,D,E,F,G, andH
And there are eight output fields:
- four scalar outputs:
oa,ob,oc, andod - four vector outputs:
oA,oB,oC, andoD
The expression syntax is quite similar to C/C++, just with a very limited set of keywords and functions. Lowkey cozy.
An example:
oa = a * (0.5 + b) / c
So that multiplies the value in a with the value in b plus 0.5, divides that result with c, and parks the result in oa. π
But here's the important bit β since this is an engine, the expression is only evaluated when someone tries to read the value in oa. Not every time an input changes. Lazy evaluation, and honestly? Relatable. π
All inputs are multi-fields, and if there are several values in an input, the expression gets evaluated once for every input field value, and the output creates as many values as there are input field values. Yes bestie, it multiplies out like that. π₯
If there's more than one input field, and those input fields don't have the same number of values, the engine creates as many output values as the input field with the biggest number of values. And when the index goes out of bounds for some other input field, the last field value gets used. That's the rule, no cap.
Vector expressions are basically the same as scalar expressions. An example:
oA = A + vec3f(1.0, 0.0, 0.0) * B
That takes the vector in A, adds the value in B multiplied with (1,0,0), and drops the result in oA. Slay. π¦
In addition to regular arithmetics, the SoCalculator syntax also includes some functions.
πΈ Scalar functions πΈ
cos(x)β cosine function (xin radians)sin(x)β sinus functiontan(x)β tangent functionacos(x)β arc cosine functionasin(x)β arc sinus functionatan(x)β arc tangent functionatan2(y, x)β arc tangent function of two variables (y,x).cosh(x)β hyperbolic cosine functionsinh(x)β hyperbolic sinus functiontanh(x)β hyperbolic tangent functionsqrt(x)β square root functionpow(x,y)βxraised to the power ofyexp(x)βeto the power ofxlog(x)β natural logarithm ofxlog10()β base-10 logarithm ofxceil(x)β roundsxupwards to the nearest integerfloor(x)β roundsxdownwards to the nearest integerfabs(x)β absolute valuefmod(x, y)β remainder of dividingxbyyrand(x)β pseudo-random value between0and1
π§ Vector functions π§
cross(x, y)β cross product ofxandydot(x,y)β dot product ofxandy(returns scalar value)length(x)β length ofx(returns scalar value)normalize(x)β returns normalized version ofxx[y]β access components inx(yshould be a scalar value in the range[0,2])
There are also some named constants that can be used:
MAXFLOATMINFLOATM_EM_LOG2EM_LOG10EM_LN2M_PIM_SQRT2βsqrt(2)M_SQRT1_2βsqrt(1/2)
The only control flow available is the ? operator. An example:
oa = (a > b) ? (a * 0.5) : (b * c)
(The parentheses are not necessary, they're there just to make the example easier to read. Considerate of them honestly π«Ά)
In addition to the standard comparison operators (<, >, <=, >=, ==, !=), you can also use && (AND) and || (OR) to combine expression, and the unary ! (NOT) operator.
One final thing worth mentioning are the temporary variables. There exist sixteen temporary variables that can be used in expressions. ta, tb, tc, td, te, tf, tg, and th are scalar variables, and tA, tB, tC, tD, tE, tF, tG, and tH are vector variables. They're usually used when you have more than one expression that should be evaluated in order. β¨
An example with three expressions:
ta = a * b; tb = c + d; tc = e - f
tA = vec3f(ta, tb, tc) + A
oA = tA * B
That example just shows how temporary variables can be used to make your expressions easier to read. And please note β it's possible to have several statements in one expression. You just separate them with semicolons. Periodt. π
Here's a simple example of how an SoCalculator engine may be used in an .iv file:
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 {}
}
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. It's giving sneaky little dependency, and we're obsessed. π
π Constructor & Destructor Documentation π
SoCalculator::SoCalculator (void )
Constructor. β¨
SoCalculator::~SoCalculator (void ) [protected], [virtual]
Destructor. π
π Member Function Documentation π
SoType SoCalculator::getClassTypeId (void ) [static]
This static method returns the SoType object associated with objects of this class.
SoType SoCalculator::getTypeId (void ) const [virtual]
Returns the type identification of an object derived from a class inheriting SoBase. This is used for runtime type checking and "downward" casting.
Implements SoBase.
const SoFieldData ** SoCalculator::getInputDataPtr (void ) [static], [protected]
Returns the SoFieldData class which holds information about inputs in this engine.
const SoEngineOutputData ** SoCalculator::getOutputDataPtr (void ) [static], [protected]
Returns the SoEngineOutputData class which holds information about the outputs in this engine.
const SoFieldData * SoCalculator::getFieldData (void ) const [virtual]
Returns the SoFieldData class which holds information about inputs in this engine.
Reimplemented from SoFieldContainer.
const SoEngineOutputData * SoCalculator::getOutputData (void ) const [virtual]
Returns the SoEngineOutputData class which holds information about the outputs in this engine.
Implements SoEngine.
void * SoCalculator::createInstance (void ) [static]
Creates a new instance of the class type corresponding to the SoType object.
void SoCalculator::inputChanged (SoField * which) [protected], [virtual]
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. π«‘
Reimplemented from SoEngine.
π Member Data Documentation π
SoMFFloat SoCalculator::a
Input floating point value for the expressions.
SoMFFloat SoCalculator::b
Input floating point value for the expressions.
SoMFFloat SoCalculator::c
Input floating point value for the expressions.
SoMFFloat SoCalculator::d
Input floating point value for the expressions.
SoMFFloat SoCalculator::e
Input floating point value for the expressions.
SoMFFloat SoCalculator::f
Input floating point value for the expressions.
SoMFFloat SoCalculator::g
Input floating point value for the expressions.
SoMFFloat SoCalculator::h
Input floating point value for the expressions.
SoMFVec3f SoCalculator::A
Input vector with three floating point values for the expressions.
SoMFVec3f SoCalculator::B
Input vector with three floating point values for the expressions.
SoMFVec3f SoCalculator::C
Input vector with three floating point values for the expressions.
SoMFVec3f SoCalculator::D
Input vector with three floating point values for the expressions.
SoMFVec3f SoCalculator::E
Input vector with three floating point values for the expressions.
SoMFVec3f SoCalculator::F
Input vector with three floating point values for the expressions.
SoMFVec3f SoCalculator::G
Input vector with three floating point values for the expressions.
SoMFVec3f SoCalculator::H
Input vector with three floating point values for the expressions.
SoMFString SoCalculator::expression
Mathematical expressions for the calculator.
SoEngineOutput SoCalculator::oa
(SoMFFloat) Output value with result from the calculations.
SoEngineOutput SoCalculator::ob
(SoMFFloat) Output value with result from the calculations.
SoEngineOutput SoCalculator::oc
(SoMFFloat) Output value with result from the calculations.
SoEngineOutput SoCalculator::od
(SoMFFloat) Output value with result from the calculations.
SoEngineOutput SoCalculator::oA
(SoMFVec3f) Output value with result from the calculations.
SoEngineOutput SoCalculator::oB
(SoMFVec3f) Output value with result from the calculations.
SoEngineOutput SoCalculator::oC
(SoMFVec3f) Output value with result from the calculations.
SoEngineOutput SoCalculator::oD
(SoMFVec3f) Output value with result from the calculations.
π Author π
Generated automatically by Doxygen for Coin from the source code. Yes bestie, a robot wrote this about a robot calculator. We love a machine-written king. π
And that's the whole page, babes! π This was Version 4.0.10, dated Thu Jun 25 2026 00:00:00, filed under SoCalculator(3). Go forth and calculate. π
β¨
π¦ where this page comes from
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 43: Coin4-devel 4.0.10-1.fc43 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- fedora 44: Coin4-devel 4.0.10-1.fc44 Β· BSD-3-Clause AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms