2.3. Scene Basic Types

This section discusses Inventor's Sb classes, a set of basic types that are used in many Inventor objects. Inventor includes useful methods for converting between different types and performing specific 3D operations on them.

Inventor defines the following types:

SbBool

Boolean value (TRUE or FALSE)

SbBox nx

2D or 3D box that has planes parallel to the major axes and is specified by two points on a diagonal (includes SbBox3f( C++ | Java ), SbBox2f( C++ | Java ), SbBox2s( C++ | Java )); n is the number of values in the type (2 or 3), and x is the value type (f for float, s for short)

SbColor( C++ | Java )

RGB (red/green/blue) color value with conversion routines to other color spaces

SbCylinder( C++ | Java )

cylinder

SbLine( C++ | Java )

directed 3D line

SbMatrix( C++ | Java )

4×4 matrix

SbName( C++ )

character string stored in a special table for fast and easy comparison, typically for identifiers

SbPList( C++ )

list of generic (void *) pointers

SbPlane( C++ | Java )

oriented 3D plane

SbRotation( C++ | Java )

representation of a 3D rotation about an arbitrary axis

SbSphere( C++ | Java )

sphere

SbString( C++ )

“smart” character strings that have many convenience methods for easy string manipulation

SbTime( C++ | Java )

representation of time—in seconds; seconds and microseconds; or using the timeval structure

SbVec nx

2D or 3D vector, used to represent points or directions (includes SbVec2f( C++ | Java ), SbVec3f( C++ | Java ), SbVec2s( C++ | Java )); n is the number of values in the type (2, 3, or 4), and x is the value type (f for float; s for short)

SbViewportRegion( C++ | Java )

active viewport region within a display window

SbViewVolume( C++ | Java )

view volume (for example, see SoCamera( C++ | Java | .NET )'s getViewVolume() method in the Open Inventor C++ Reference Manual)

Each Sb class has useful operators associated with it. For example, you can negate a variable of typeSbVec3f( C++ | Java ), multiply it by a matrix, or normalize it to unit length. The following code creates a unit-length vector, based on the specified direction:


C++
SbVec3f v(1.0, 2.0, 3.0); // declares and initializes the vector
v.normalize(); // normalizes the vector to unit length
    

.NET
SbVec3f v = new SbVec3f(1.0f, 2.0f, 3.0f); // declares and initializes the vector
v.Normalize(); // normalizes the vector to unit length
    

Java
SbVec3f v = new SbVec3f(1.0f, 2.0f, 3.0f); // declares and initializes the vector
v.normalize(); // normalizes the vector to unit length
    

Similarly, SbMatrix( C++ | Java ) has useful methods including multVecMatrix(), which multiplies a row vector by the matrix and returns the result, and rotate(), which sets the matrix to rotate by a given amount. See the Open Inventor C++ Reference Manual for a complete description of the available methods for each Sb class.

Chapter 3, Nodes and Groups contains a complete discussion of fields, which are the structures that store parameters for nodes. A field contains a value of a certain type. Fields are always contained within Inventor nodes. Many fields contain a corresponding Sb type. For example: