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:
Boolean value (TRUE or FALSE) | |
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) | |
RGB (red/green/blue) color value with conversion routines to other color spaces | |
cylinder | |
directed 3D line | |
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 |
oriented 3D plane | |
representation of a 3D rotation about an arbitrary axis | |
sphere | |
SbString( C++ ) | “smart” character strings that have many convenience methods for easy string manipulation |
representation of time—in seconds; seconds and microseconds; or using the timeval structure | |
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) | |
active viewport region within a display window | |
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:
SbVec3f v(1.0, 2.0, 3.0); // declares and initializes the vector v.normalize(); // normalizes the vector to unit length
SbVec3f v = new SbVec3f(1.0f, 2.0f, 3.0f); // declares and initializes the vector v.Normalize(); // normalizes the vector to unit length
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: