NODE PROPERTIES
WTK functions provide access to three useful properties that describe the space occupied by the geometries in a scene graph.
figure 10
The following chart list the node property access functions
FUNCTION | EXPLANATION |
WTnode_getextents | Function obtains the extents (including the node children and grand-children) if a specified node. |
WTnode_getradius | Function obtains the radius (including the nodes children and grand-children) of the specified node. |
WTnode_getmidpoint | Function obtains the midpoint (including the nodes children and grand-childless) of the specified node. |
WTnode_getextents
The extents box of a node in a scene graph is relative to the coordinate system )the X, Y, Z axes) defined by the transformation accumulated by traversing the scene graph as far as that node. A nodes extents box encloses the geometries beginning at the specified node and including all children and grandchildren. These comprise the node and its sub-tree.
SYNTAX:
FLAG WTnode_getextents(WTnode *node, WTp3 extents);
ARGUMENTS:
node -- The node to retrieve the extents from
extents -- A WTp3 that will receive the extents information
RETURN TYPE:
Returns false if the node passed in cannot have children or it is not a geometry node itself
WTnode_getradius
The radius of a node is defined as the distance from the midpoint
of the nodes extents box to one of its corners (see figure 10)
SYNTAX:
float WTnode_getradius(WTnode *node);
ARGUMENTS:
node -- The node in question
RETURN TYPE:
float that is the distance.
WTnode_getmidpoint
The midpoint of a node is the midpoint of the nodes extents box.
SYNTAX:
FLAG WTnode_getmidpoint(WTnode *node, WTp3 midpoint);
ARGUMENTS:
node -- The node in question
midpoint -- A WTp3 that will receive the midpoint information
RETURN TYPE:
Returns false if the node passed in cannot have children or it is not a geometry node itself.
Turning on a nodes bounding (extents) box
WTnode_boundingbox
This function is a toggle to turn on and off a nodes extents box. The color of the extents box can be set using the WTuniverse_setbbrgb function.
SYNTAX:
void WTnode_boundingbox(FLAG toggle);
ARGUMENTS:
toggle -- If this argument is TRUE then the bounding box is drawn. FALSE turns the bounding box off.
NOTE: Bounding boxes ore off by default.
RETURN TYPE:
Void
Assignment 8
project definition: