<< Click to Display Table of Contents >> Navigation: Simplygon API 7.1 User guide > Working with transforms |
The Simplygon API allows the user to do transformations on geometry data and scene nodes (see section on scenes).
IMatrix4x4
The IMatrix4x4 class is used to represent a standard or homogeneous 4x4 matrix inside the Simplygon API. The matrix is stored in a row major form. The class provides methods for accessing and setting matrix elements, transposing a matrix, calculating an inverse and can be used to transform 3D homogeneous coordinates.
ITransform3
The ITransform3 class is a utility class to setup a 4x4 homogeneous transform in the Simplygon API. You can use the ITransform3 to concatenate transformations. Transforms can be performed by calling AddTranslation, AddRotation and AddScaling. AddRotationworks like a quaternion where you pass in the angle of rotation in radians and set the axis along which to rotate. The PreMultiplyfunction can be use to add a transform around the current transform and PostMultiply can be used to add a transform inside the current transform. The default behaviour is set to do post multiplication.
Transformation Example
void TransformGeometryData(spGeometryData geom)
{
spTransform3 xform = sg->CreateTransform3();
// Set the tranfrom to use pre multiply.
xform->PreMultiply();
// Do a translations transformation.
xform->AddTranslation(0,5.0,0.0);
// ... do other transformations ...
geom->Transform(xform);
}