Skip to content

Commit a51f761

Browse files
author
pierre
committed
move functions missing from orion into gemini impl
1 parent 9330aa0 commit a51f761

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/connection.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -312,28 +312,6 @@ impl Connection {
312312
}
313313
}
314314

315-
#[doc = " Returns an OpenCV-compatible camera matrix."]
316-
#[doc = " @param hConnection The connection handle created by LeapCreateConnection()."]
317-
#[doc = " @param camera The camera to use, a member of the eLeapPerspectiveType enumeration"]
318-
#[doc = " @param[out] dest A pointer to a single-precision float array of size 9"]
319-
#[doc = " @since 3.2.1"]
320-
pub fn camera_matrix(&mut self, camera: PerspectiveType, dest: &mut [f32; 9]) {
321-
unsafe { LeapCameraMatrix(self.handle, camera.into(), dest.as_mut_ptr()) }
322-
}
323-
324-
#[doc = " Returns an OpenCV-compatible lens distortion using the 8-parameter rational"]
325-
#[doc = " model."]
326-
#[doc = ""]
327-
#[doc = " The order of the returned array is: [k1, k2, p1, p2, k3, k4, k5, k6]"]
328-
#[doc = ""]
329-
#[doc = " @param hConnection The connection handle created by LeapCreateConnection()."]
330-
#[doc = " @param camera The camera to use, a member of the eLeapPerspectiveType enumeration"]
331-
#[doc = " @param[out] dest A pointer to a single-precision float array of size 8."]
332-
#[doc = " @since 3.2.1"]
333-
pub fn distortion_coeffs(&mut self, camera: PerspectiveType, dest: &mut [f32; 8]) {
334-
unsafe { LeapDistortionCoeffs(self.handle, camera.into(), dest.as_mut_ptr()) }
335-
}
336-
337315
#[doc = " Provides the corrected camera ray intercepting the specified point on the image."]
338316
#[doc = ""]
339317
#[doc = " Given a point on the image, ``LeapPixelToRectilinear()`` corrects for camera distortion"]
@@ -783,6 +761,28 @@ impl Connection {
783761
LeapDistortionCoeffsEx(self.handle, device.handle, camera.into(), dest.as_mut_ptr())
784762
}
785763
}
764+
765+
#[doc = " Returns an OpenCV-compatible camera matrix."]
766+
#[doc = " @param hConnection The connection handle created by LeapCreateConnection()."]
767+
#[doc = " @param camera The camera to use, a member of the eLeapPerspectiveType enumeration"]
768+
#[doc = " @param[out] dest A pointer to a single-precision float array of size 9"]
769+
#[doc = " @since 3.2.1"] // Actually not present in orion LeapC
770+
pub fn camera_matrix(&mut self, camera: PerspectiveType, dest: &mut [f32; 9]) {
771+
unsafe { LeapCameraMatrix(self.handle, camera.into(), dest.as_mut_ptr()) }
772+
}
773+
774+
#[doc = " Returns an OpenCV-compatible lens distortion using the 8-parameter rational"]
775+
#[doc = " model."]
776+
#[doc = ""]
777+
#[doc = " The order of the returned array is: [k1, k2, p1, p2, k3, k4, k5, k6]"]
778+
#[doc = ""]
779+
#[doc = " @param hConnection The connection handle created by LeapCreateConnection()."]
780+
#[doc = " @param camera The camera to use, a member of the eLeapPerspectiveType enumeration"]
781+
#[doc = " @param[out] dest A pointer to a single-precision float array of size 8."]
782+
#[doc = " @since 3.2.1"] // Actually not present in orion LeapC
783+
pub fn distortion_coeffs(&mut self, camera: PerspectiveType, dest: &mut [f32; 8]) {
784+
unsafe { LeapDistortionCoeffs(self.handle, camera.into(), dest.as_mut_ptr()) }
785+
}
786786
}
787787

788788
#[cfg(test)]
@@ -883,6 +883,12 @@ mod tests {
883883
&mut distortion_coeffs,
884884
);
885885

886+
let mut camera_matrix = [0.0; 9];
887+
connection.camera_matrix(PerspectiveType::StereoLeft, &mut camera_matrix);
888+
889+
let mut distortion_coeffs = [0.0; 8];
890+
connection.distortion_coeffs(PerspectiveType::StereoRight, &mut distortion_coeffs);
891+
886892
let leap_vector = LeapVector::new(0.0, 0.0, 1.0);
887893
connection.pixel_to_rectilinear_ex(&device, PerspectiveType::StereoLeft, &leap_vector);
888894
connection.rectilinear_to_pixel_ex(&device, PerspectiveType::StereoRight, &leap_vector);
@@ -962,12 +968,6 @@ mod tests {
962968
fn safety_sanity() {
963969
let mut connection = initialize_connection();
964970

965-
let mut camera_matrix = [0.0; 9];
966-
connection.camera_matrix(PerspectiveType::StereoLeft, &mut camera_matrix);
967-
968-
let mut distortion_coeffs = [0.0; 8];
969-
connection.distortion_coeffs(PerspectiveType::StereoRight, &mut distortion_coeffs);
970-
971971
let leap_vector = LeapVector::new(0.0, 0.0, 1.0);
972972
connection.pixel_to_rectilinear(PerspectiveType::StereoLeft, &leap_vector);
973973
connection.rectilinear_to_pixel(PerspectiveType::StereoRight, &leap_vector);

0 commit comments

Comments
 (0)