2d to 3d was impl'd in the library!

This commit is contained in:
Brandon Thomas committed 2020-04-17 00:17:37 -04:00
1 parent e94b9c44dd
commit 2e6597048b
1 file changed
+17 -6
+17 -6
View File
@@ -4,7 +4,7 @@
use std::ffi::CString;
use std::fmt::{Error, Formatter};
use std::mem::size_of;
use std::os::raw::c_void;
use std::os::raw::{c_void, c_int};
use std::ptr;
use std::ptr::null;
use std::str;
@@ -440,17 +440,28 @@ impl PointCloudComputeShader {
for x in 0..width {
p.xy.x = x as f32;
// TODO: Implement the function this calls.
// TODO: Implement the function this calls.
// TODO: Implement the function this calls.
// TODO: Implement the function this calls.
if (true) {
let mut result : c_int = -1;
unsafe {
// https://docs.rs/k4a-sys/0.2.0/k4a_sys/fn.k4a_calibration_2d_to_3d.html
k4a_sys::k4a_calibration_2d_to_3d(
&calibration,
&p, // source point 2d
1.0, // source depth mm
calibration_type, // source camera
calibration_type, // target camera
&mut ray, // target point3d mm
&mut result // set to zero when valid result
);
};
if result == 0 {
unsafe {
table_data2[idx].xy.x = ray.xyz.x;
table_data2[idx].xy.y = ray.xyz.y;
}
} else {
unsafe {
// This pixel is invalid
table_data2[idx].xy.x = 0.0;
table_data2[idx].xy.y = 0.0;
}