/** * Get the current angle in degrees * * @return the angle or 0 if the device is closed */ public synchronized double getTilt() { if (device == null) return 0; libfreenectLibrary.freenect_update_tilt_state(device); final Pointer<freenect_raw_tilt_state> state = libfreenectLibrary.freenect_get_tilt_state(device); return libfreenectLibrary.freenect_get_tilt_degs(state); }
/** * Get the current angle in degrees * * @return the angle or 0 if the device is closed */ public synchronized double getTilt() { if (device == null) return 0; libfreenectLibrary.freenect_update_tilt_state(device); final Pointer<freenect_raw_tilt_state> state = libfreenectLibrary.freenect_get_tilt_state(device); return libfreenectLibrary.freenect_get_tilt_degs(state); }
/** * Determine the current tilt status of the device * * @return the tilt status or null if the device is closed */ public synchronized KinectTiltStatus getTiltStatus() { if (device == null) return null; libfreenectLibrary.freenect_update_tilt_state(device); final Pointer<freenect_raw_tilt_state> state = libfreenectLibrary.freenect_get_tilt_state(device); final ValuedEnum<freenect_tilt_status_code> v = libfreenectLibrary.freenect_get_tilt_status(state); for (final freenect_tilt_status_code c : freenect_tilt_status_code.values()) if (c.value == v.value()) return KinectTiltStatus.valueOf(c.name()); return null; }
/** * Determine the current tilt status of the device * * @return the tilt status or null if the device is closed */ public synchronized KinectTiltStatus getTiltStatus() { if (device == null) return null; libfreenectLibrary.freenect_update_tilt_state(device); final Pointer<freenect_raw_tilt_state> state = libfreenectLibrary.freenect_get_tilt_state(device); final ValuedEnum<freenect_tilt_status_code> v = libfreenectLibrary.freenect_get_tilt_status(state); for (final freenect_tilt_status_code c : freenect_tilt_status_code.values()) if (c.value == v.value()) return KinectTiltStatus.valueOf(c.name()); return null; }
/** * Get the current acceleration values from the device * * @return the acceleration or null if the device is closed */ public synchronized KinectAcceleration getAcceleration() { if (device == null) return null; final Pointer<Double> px = Pointer.pointerToDouble(0); final Pointer<Double> py = Pointer.pointerToDouble(0); final Pointer<Double> pz = Pointer.pointerToDouble(0); libfreenectLibrary.freenect_update_tilt_state(device); final Pointer<freenect_raw_tilt_state> state = libfreenectLibrary.freenect_get_tilt_state(device); libfreenectLibrary.freenect_get_mks_accel(state, px, py, pz); return new KinectAcceleration(px.getDouble(), py.getDouble(), pz.getDouble()); }
/** * Get the current acceleration values from the device * * @return the acceleration or null if the device is closed */ public synchronized KinectAcceleration getAcceleration() { if (device == null) return null; final Pointer<Double> px = Pointer.pointerToDouble(0); final Pointer<Double> py = Pointer.pointerToDouble(0); final Pointer<Double> pz = Pointer.pointerToDouble(0); libfreenectLibrary.freenect_update_tilt_state(device); final Pointer<freenect_raw_tilt_state> state = libfreenectLibrary.freenect_get_tilt_state(device); libfreenectLibrary.freenect_get_mks_accel(state, px, py, pz); return new KinectAcceleration(px.getDouble(), py.getDouble(), pz.getDouble()); }