You can assign a required transformation to a transformation matrix object. You can then use it to apply the transformation to a point cloud or 3D geometry. This allows you to displace, rotate, or scale coordinates, or allows you to fixture the point cloud or 3D geometry to a required position or orientation.
Once you have allocated a transformation matrix object using M3dgeoAlloc(), you can generate the required transformation coefficients using the transformation functions M3dgeoMatrixSetWithAxes() and/or M3dgeoMatrixSetTransform(). Use M3dgeoMatrixSetWithAxes() to define a transformation that transforms points from the working coordinate system into a new specified coordinate system. Use M3dgeoMatrixSetTransform() to define a transformation that modifies coordinates within the working coordinate system.
Once you have defined the required transformation, you can then apply the transformation matrix to a point cloud or 3D geometry using M3dimMatrixTransform(). You can also copy a transformation matrix object using M3dgeoCopy().
To change coordinates such that your 3D points are tied to a new coordinate system, define a transformation matrix using M3dgeoMatrixSetWithAxes(). With this function, you can set a new origin and axes. When applied using M3dimMatrixTransform(), the transformation matrix modifies coordinates so that they are relative to the new origin and axes.
To alter coordinates such that your 3D points are modified within the working coordinate system, use M3dgeoMatrixSetTransform(). With this function, you can define a transformation matrix to displace, rotate, or scale coordinates, or you can compose 2 transformation matrices to perform multiple transformations.
There are several ways to define a transformation matrix using M3dgeoMatrixSetTransform().
To define a transformation matrix to perform a translation, use the M_TRANSLATION transformation type and specify the required coordinate displacements along each of the axes of the working coordinate system.
To define a transformation matrix to perform a rotation, you can specify 1 of several rotation operations (M_ROTATION_...). You can rotate around 1 axis (for example, M_ROTATION_X) or around all three axes (for example, M_ROTATION_XYZ), or you can specify a vector around which to rotate (M_ROTATION_AXIS_ANGLE). For each of these transformation types, you must specify the amount of rotation in degrees. You can also specify a quaternion rotation (M_ROTATION_QUATERNION).
To define a transformation matrix to perform a scaling operation, use the M_SCALE transformation type and specify a scale factor for which coordinate distances will be multiplied. When the transformation matrix is applied, each coordinate's distance from the origin (along each axis) increases or decreases (if a negative scale factor is specified) accordingly.
You can specify a transformation matrix that can move the working coordinate system to a 3D geometry (M_FIXTURE_TO_GEOMETRY), or you can specify a transformation that can move the XY (Z=0) plane of the working coordinate system to a specified plane (M_FIXTURE_TO_PLANE).
Using M3dgeoMatrixSetTransform(), you can specify to compose 2 transformation matrix objects (M_COMPOSE_TWO_MATRICES), or to compose the specified transformation with the given transformation matrix object (M_COMPOSE_WITH_CURRENT).