The following calls multiply a node's transformation matrix
T with a translation, scaling or rotation matrix.
Note that the
T matrix may also be manipulated directly with the
M_Matrix(3) interface.
void SG_Identity (SG_Node *node)
void SG_Translate (SG_Node *node, M_Real x, M_Real y, M_Real z)
void SG_Translatev (SG_Node *node, M_Vector3 v)
void SG_TranslateX (SG_Node *node, M_Real x)
void SG_TranslateY (SG_Node *node, M_Real y)
void SG_TranslateZ (SG_Node *node, M_Real z)
void SG_Scale (SG_Node *node, M_Real s)
void SG_Rotatev (SG_Node *node, M_Real theta, M_Vector3 axis)
void SG_RotateI (SG_Node *node, M_Real theta)
void SG_RotateJ (SG_Node *node, M_Real theta)
void SG_RotateK (SG_Node *node, M_Real theta)
void SG_Rotatevd (SG_Node *node, M_Real degrees, M_Vector3 axis)
void SG_RotateId (SG_Node *node, M_Real degrees)
void SG_RotateJd (SG_Node *node, M_Real degrees)
void SG_RotateKd (SG_Node *node, M_Real degrees)
void SG_GetNodeTransform (void *node, M_Matrix44 *T)
void SG_GetNodeTransformInverse (void *node, M_Matrix44 *T)
M_Vector3 SG_NodePos (SG_Node *node)
M_Vector3 SG_NodeDir (SG_Node *node)
M_Real SG_NodeSize (SG_Node *node)
SG_Identity() sets the transformation matrix of the node to the identity matrix.
The
SG_Translate*() functions multiply
T by a translation matrix.
The
SG_Scale() function multiplies
T by a uniform scaling matrix.
SG_Rotate*() multiply
T by a rotation matrix.
Angles are given in radians, except for
SG_Rotate*d() variants which accept angular arguments in degrees.
SG_Rotatev() generates a rotation of
theta radians around
axis. Note that most of the preceding functions are trivial wrappers around
M_Matrix(3) functions (applied to the transformation matrix
T of the node).
The
SG_GetNodeTransform() function returns a transformation matrix mapping the node back to world
coordinates (i.e., by computing the product of the transformation matrices
of the node and its parents).
SG_GetNodeTransformInverse() returns the inverse of this matrix.
The
SG_NodePos() function returns a vector representing the absolute world coordinates of
a node.
SG_NodeDir() returns a normalized vector representing the direction of a node with respect
to the world Z axis (i.e., the Z axis of the origin node).
SG_NodeSize() returns the absolute scaling factor of an object.
|
STRUCTURE DATA
For the
SG_Node object:
Uint flags | Option flags (see
FLAGS section).
| SG *sg | Back pointer to parent
SG(3) object.
| M_Matrix44 T | Transformation matrix (relative to parent node).
|
|
FLAGS
For the
SG_Node object:
SG_NODE_SELECTED | Node is selected (e.g., for edition).
|
|
EXAMPLES
See
sg/sg_dummy.c in the Agar source distribution for an example node class implementation.
|
SEE ALSO
HISTORY
The
SG_Node node class first appeared in
Agar 1.6.0.
|
|
|