Purpose

CompareInventorSceneSampling allows the storage of an Open Inventor scene as rendered primitives and provides comparison functionality to check whether a stored scene equals the currently connected one. Therefore it is a useful module to write tests for scene object modules.

Caveats:

  • Primitives can only be compared if the Open Inventor modules which generate them also implement the SoCallbackAction correctly.
  • Texture features are compared, however, but not the contents of the texture images themselves.
  • On SoText2 nodes all field contents are also stored and restored for comparisons although not rendered as primitives. It has been implemented as special case since it’s often used and important for testing.

Windows

Default Panel

../../../Projects/CompareInventorSceneSampling/Modules/mhelp/Images/Screenshots/CompareInventorSceneSampling._default.png

Input Fields

inInventorScene

name: inInventorScene, type: SoNode

The Open Inventor scene graph to be stored as rendered primitives or to be compared with.

Parameter Fields

Field Index

Compare: Trigger Post ML error on failure: Bool
Error Post Prefix: String Remove File: Trigger
File Name: String Save: Trigger
Float Epsilon: Float Status: String
Num Lines: Integer Test Passed: Bool
Num Primitives: Integer  
Num Triangles: Integer  
Num Vertices: Integer  

Visible Fields

File Name

name: fileName, type: String

The file name in which the primitives can be stored or from which the primitives are read when compared.

Save

name: save, type: Trigger

Renders the connected scene graph as primitives and stores them in the file defined in File Name.

Remove File

name: removeFile, type: Trigger

Removes the file defined in File Name; if the file does not exist then no ML error is posted, however, the status line will show that no removal took place.

Compare

name: compare, type: Trigger

Renders the connected scene graph as primitives and compares them with those loaded from the file defined in File Name. If they equal the Test Passed is enabled, otherwise disabled. If Post ML error on failure is enabled and comparison fails then also an ML error is posted as described for Post ML error on failure.

Float Epsilon

name: floatEpsilon, type: Float, default: 0.001, minimum: 0

When comparing a primitives from a stored file and rendered ones from the connected input scene then floating point numbers typically will normally differ due imprecise numerical calculations. This epsilon is the maximum difference allowed between floating point number before they are considered different.

Post ML error on failure

name: postMLErrorOnFailure, type: Bool, default: TRUE

If enabled and a comparison with Compare or a save operation with Save fails, then an ML error is posted to the ML error handler. This is useful to make scene equality tests fail. If disabled then only Status and Test Passed will show information about the success of the recent operations.

Error Post Prefix

name: errorPostPrefix, type: String, default: Failure in scene primitive operation:

Only sensitive if Post ML error on failure is enabled. If that one is on and an operation fails then the posted ML error log will get Error Post Prefix as prefix. This can be useful to describe the type of the error, or to make differences to the results of other compare modules more obvious.

Num Primitives

name: numPrimitives, type: Integer, minimum: 0, persistent: no

Shows the whole number of stored primitives (vertices+lines+triangles) after save operations.

Num Vertices

name: numVertices, type: Integer, minimum: 0, persistent: no

Shows the number of stored vertices after save operations.

Num Lines

name: numLines, type: Integer, minimum: 0, persistent: no

Shows the number of stored lines after save operations.

Num Triangles

name: numTriangles, type: Integer, minimum: 0, persistent: no

Shows the number of stored triangles after save operations.

Test Passed

name: testPassed, type: Bool, persistent: no

Checked after a successful compare operation with Compare, otherwise false. Can be used to test for a successful operation, especially if ML error posting with Post ML error on failure is disabled.

Status

name: status, type: String, persistent: no

Shows information about and results of the recently performed module operation.