pub unsafe extern "C" fn LeapGetDeviceTransform(
hDevice: LEAP_DEVICE,
transform: *mut f32,
) -> eLeapRSExpand description
\ingroup Functions Get the transform to world coordinates from 3D Leap coordinates.
To get the transform, you must supply an array of 16 elements.
The function will return a an array representing a 4 x 4 matrix of the form:
R, t 0, 1
where: R is a 3 x 3 rotation matrix t is a 3 x 1 translation vector
Note that the matrix is in column major, e.g. transform[12] corresponds to the x coordinate of the translation vector t.
A possible pipeline would be, for example:
- Get “palm_pos” the position of the center of the palm (as a 3x1 vector)
- Construct a 4x1 vector using the palm_position: palm_pos_4 = (palm_pos.x; palm_pos.y; palm_pos.z; 1.0f)
- Create a 4x4 matrix “trans_mat” as illustrated above using the returned transform
- Get the position of the center of the palm in world coordinates by multiplying trans_mat and palm_pos_4: center_world_4 = trans_mat * palm_pos_4
This function returns eLeapRS_Unsupported in the case where this functionality is not yet supported.
@param hDevice A handle to the device to be queried. @param[out] transform A pointer to a single-precision float array of size 16, containing the coefficients of the 4x4 matrix in Column Major order. @returns The operation result code, a member of the eLeapRS enumeration. @since 5.4.0