ReconstructMe SDK  1.2.742-76069
Real-time 3D reconstruction engine
 All Classes Files Functions Typedefs Enumerations Enumerator Groups Pages
Transform

Access and manipulate transformation matrices. More...

reme_error_t reme_transform_set_predefined (reme_context_t c, reme_transform_t t, float *coordinates)
 Set the matrix to a predefined transform.
 
reme_error_t reme_transform_look_at (reme_context_t c, const float *eye, const float *ref, const float *up, float *coordinates)
 Defines a viewing transformation.
 
reme_error_t reme_transform_make_relative (reme_context_t c, const float *a_t, const float *b_t, float *c_t)
 Calculate the relative transform between two coordinate frames.
 

Detailed Description

Access and manipulate transformation matrices.

In the ReconstructMe SDK rigid transformations are represented using 4x4 floating point homogeneous matrices. The upper 3x3 part contains the rotation matrix. The last column contains the translation vector. The last row is constant.

| Rxx Rxy Rxz Tx |
| Ryx Ryy Ryz Ty |
| Rzx Rzy Rzz Tz |
|   0   0   0  1 |

The memory layout is row-major. Flattened to a one dimensional array the above matrix is transformed into

| Rxx Rxy Rxz Tx Ryx Ryy Ryz Ty Rzx Rzy Rzz Tz 0 0 0 1|

Coordinate systems are represented by 4x4 single precision floating point homogeneous matrices. The upper 3x3 part contains the basis vectors in columns, the last column contains the origin of the frame and the last row is constant.

Function Documentation

reme_error_t reme_transform_set_predefined ( reme_context_t  c,
reme_transform_t  t,
float *  coordinates 
)

Set the matrix to a predefined transform.

Parameters
cA valid context object
tA predefined transform type
coordinatesA pointer to mutable Transform data.
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure
Examples:
example_reconstructmesdk_memory_management.cpp, and example_reconstructmesdk_surface.cpp.
reme_error_t reme_transform_look_at ( reme_context_t  c,
const float *  eye,
const float *  ref,
const float *  up,
float *  coordinates 
)

Defines a viewing transformation.

This method works similarily to gluLookAt. It defines a viewing transformation based on the eye coordinates, a viewing reference point and an up vector. This method simplifies specifying sensor positions (reme_sensor_set_position).

First, the view direction is vz is calculated by vz = ref - eye. This vector is normalized to unit length vz = vz / |vz| and becomes the z-vector of the viewing transformation. Next, the up vector is normalized to unit length up = up / |up|.

The cross product vx = -up x vz will become the x-axis of the viewing transformation after normalization vx = vx / |vx|.

Finally the cross product of vy = vz x vx defines the y-axis of the viewing transformation. The origin of the viewing transformation is set to the eye coordinates.

The final matrix becomes

| vx.x vy.x vz.x eye.x |
| vx.y vy.y vz.y eye.y |
| vx.z vy.z vz.z eye.z |
|    0    0    0     1 |
Parameters
cA valid context object
eyethree dimensional vector defining the eye coordinates
refthree dimensional vector defining the reference point coordinates
upthree dimensional vector defining the up vector
coordinatesA pointer to mutable Transform data.
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure
Examples:
example_reconstructmesdk_sensor_printing.cpp.
reme_error_t reme_transform_make_relative ( reme_context_t  c,
const float *  a_t,
const float *  b_t,
float *  c_t 
)

Calculate the relative transform between two coordinate frames.

Given two coordinate frames, a_t and b_t in the same parental coordinate frame, calculate b_t with respect to a_t. The result is stored in c_t.

Parameters
cA valid context object
a_tA pointer to non mutable Transform data.
b_tA pointer to non mutable Transform data.
c_tA pointer to mutable Transform data.
Return values
REME_ERROR_SUCCESSOn success
REME_ERROR_UNSPECIFIEDOn failure