예제 #1
0
파일: Kinect.cs 프로젝트: old8xp/AForge.NET
        /// <summary>
        /// Get accelerometer values for 3 axes.
        /// </summary>
        ///
        /// <param name="x">X axis value on the accelerometer.</param>
        /// <param name="y">Y axis value on the accelerometer.</param>
        /// <param name="z">Z axis value on the accelerometer.</param>
        ///
        /// <remarks><para>Units of all 3 values are m/s<sup>2</sup>. The <b>g</b> value used
        /// for calculations is taken as 9.80665 m/s<sup>2</sup>.</para></remarks>
        ///
        public void GetAccelerometerValues(out double x, out double y, out double z)
        {
            KinectNative.TiltState tiltState = new KinectNative.TiltState( );

            lock ( sync )
            {
                CheckDevice( );
                tiltState = openDevices[deviceID].TiltState;
            }

            x = (double)tiltState.AccelerometerX / CountsPerGravity * Gravity;
            y = (double)tiltState.AccelerometerY / CountsPerGravity * Gravity;
            z = (double)tiltState.AccelerometerZ / CountsPerGravity * Gravity;
        }
예제 #2
0
        /// <summary>
        /// Get accelerometer values for 3 axes.
        /// </summary>
        /// 
        /// <param name="x">X axis value on the accelerometer.</param>
        /// <param name="y">Y axis value on the accelerometer.</param>
        /// <param name="z">Z axis value on the accelerometer.</param>
        /// 
        /// <remarks><para>Units of all 3 values are m/s<sup>2</sup>. The <b>g</b> value used
        /// for calculations is taken as 9.80665 m/s<sup>2</sup>.</para></remarks>
        /// 
        public void GetAccelerometerValues( out double x, out double y, out double z )
        {
            KinectNative.TiltState tiltState = new KinectNative.TiltState( );

            lock ( sync )
            {
                CheckDevice( );
                tiltState = openDevices[deviceID].TiltState;
            }

            x = (double) tiltState.AccelerometerX / CountsPerGravity * Gravity;
            y = (double) tiltState.AccelerometerY / CountsPerGravity * Gravity;
            z = (double) tiltState.AccelerometerZ / CountsPerGravity * Gravity;
        }