IBM Visualization Data Explorer Programmer's Reference

[ Bottom of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]


13.9 Basic Data Types

This section describes some basic data types used by the system, including points, vectors, triangles, colors, and matrices.

Points and Vectors

Points are represented by the Point structure. Data Explorer provides a routine that constructs a point structure. Vectors are represented by the same structure as points, but for the sake of clarity they are defined as a separate type.
typedef struct point {
    float x, y, z;
} Point, Vector;
typedef int PointId;

Point DXPt()
Point DXVec();

Construct a Point or a Vector with the given coordinates. See DXPt, DXVec.

Lines, Triangles, Quadrilaterals, Tetrahedra, and Cubes

These data structures define the interpolation elements of an Object. They refer to points by point identifiers.


typedef struct line {
    PointId p, q;
} Line;
typedef struct triangle {
    PointId p, q, r;
} Triangle;
typedef struct quadrilateral {
    PointId p, q, r, s;
} Quadrilateral;
typedef struct tetrahedron {
    PointId p, q, r, s;
} Tetrahedron;
typedef struct cube {
    PointId p, q, r, s, t, u, v, w;
} Cube;

Figure 9 shows the order of vertices in each structure. For more information about connections and the order of vertices, see Chapter 3. "Understanding the Data Model" in IBM Visualization Data Explorer User's Guide.

Figure 9. Order of Vertices in Connection Elements. In the tetrahedron at right, s is the point nearest the viewer; in the tetrahedron at center, the point furthest from the viewer.


Figure vertord not
displayed.


Line DXLn()
Triangle DXTri();
Quadrilateral DXQuad();
Tetrahedron DXTetra();

Construct a line, triangle, quadrilateral, and tetrahedron respectively, given the appropriate point identifiers. See DXLn, DXTri, DXQuad, DXTetra.

Colors

Colors define the photometric characteristics of an Object; they may be associated with points, triangles, or lights, and may be used to define its reflectance or opacity. In Data Explorer, colors are floating-point numbers and therefore open ended, as is light intensity in the real world. However, real output devices can display only a limited range of intensities. In general, the range from 0.0 to 1.0 is by default mapped onto the range of displayable intensities of the output device, so colors should normally be specified in this range. Data Explorer provides a routine that constructs an RGB color structure.

typedef struct rgbcolor {
    float r, g, b;
} RGBColor;

RGBColor DXRGB()

Constructs an RGB color structure with the given components. See DXRGB.

Error DXColorNameToRGB()

Gets the RGB values for a specified colorname string. See DXColorNameToRGB.

Angles

Angles are expressed as floating-point numbers in radians. The following macros express angles in units that might be more convenient. For example, 5*DEG is 5 degrees in radians.

typedef double Angle;
#define DEG (6.283185307179586476925287/360)
#define RAD (1)

Transformation Matrices

Transformation matrices (or transforms) specify the relationship between Objects. For example, when a renderable object is included in a model, a transformation matrix specifies its placement. In Data Explorer, a transform is a 4×3 matrix specifying rotation and translation. This is a homogeneous matrix without the part that computes the w component of the result. (The w component is used for perspective, which is specified by a camera and is not needed here.)

typedef struct matrix {
    /* xA + b */
    float A[3][3];
    float b[3];
} Matrix;
static Matrix mdentity = {
    1, 0, 0,
    0, 1, 0,
    0, 0, 1,
    0, 0, 0
};

Transforms can be specified in a number of ways:

Matrix DXRotateX()
Matrix DXRotateY();
Matrix DXRotateZ();

Return a Matrix that specifies a rotation (in radians) about the x, y or z axis by angle angle. See DXRotateX, DXRotateY, DXRotateZ, DXScale, DXTranslate, DXMat.

Matrix DXScale()

Returns a Matrix that specifies a scaling by amounts x, y, and z along the x, y and z axes. See DXRotateX, DXRotateY, DXRotateZ, DXScale, DXTranslate, DXMat.

Matrix DXTranslate()

Returns a Matrix that specifies a translation by vector v. See DXRotateX, DXRotateY, DXRotateZ, DXScale, DXTranslate, DXMat.

Matrix DXMat()

Returns a Matrix with the specified components. See DXRotateX, DXRotateY, DXRotateZ, DXScale, DXTranslate, DXMat.

Basic Operations

A number of basic operations on the Matrix, Point, and Vector types are defined here. Operations declared as operating on type Vector also work on Point because both are type-defined for structure. These operations all take their arguments by value and return the result.

Vector DXNeg()
Vector DXNormalize();
double DXLength();

Perform unary operations of negation, normalization, and length. See DXAdd, DXCross, DXDiv, DXDot, DXLength, DXMax, DXMin, DXMul, DXNeg, DXNormalize, DXSub.

Vector DXAdd()
Vector DXSub();
Vector DXMin();
Vector DXMax();

Perform vector operations of addition, subtraction, min, and max. Min and max operations are performed on each component of a vector. See DXAdd, DXCross, DXDiv, DXDot, DXLength, DXMax, DXMin, DXMul, DXNeg, DXNormalize, DXSub.

Vector DXMul();
Vector DXDiv();

Multiply or divide a vector by a floating-point number. See DXAdd, DXCross, DXDiv, DXDot, DXLength, DXMax, DXMin, DXMul, DXNeg, DXNormalize, DXSub.

float DXDot()
Vector DXCross();

Form the dot product or cross-product of two vectors. See DXAdd, DXCross, DXDiv, DXDot, DXLength, DXMax, DXMin, DXMul, DXNeg, DXNormalize, DXSub.

Matrix DXConcatenate()

Returns a Matrix equivalent to the concatenation of two matrices. See DXConcatenate, DXInvert, DXTranspose, DXAdjointTranspose, DXDeterminant, DXApply.

Matrix DXInvert()
Matrix DXTranspose();
Matrix DXAdjointTranspose();
float DXDeterminant();

Compute, respectively, the inverse, transpose, adjoint transpose, and determinant of a matrix. See DXConcatenate, DXInvert, DXTranspose, DXAdjointTranspose, DXDeterminant, DXApply.

Vector DXApply()

Forms the product of a vector (interpreted as a row vector) and a matrix. See DXConcatenate, DXInvert, DXTranspose, DXAdjointTranspose, DXDeterminant, DXApply.


[ Top of Page | Previous Page | Next Page | Table of Contents | Partial Table of Contents | Index ]
[Data Explorer Documentation | QuickStart Guide | User's Guide | User's Reference | Programmer's Reference | Installation and Configuration Guide ]

[Data Explorer Home Page]


[IBM Home Page | Order | Search | Contact IBM | Legal ]