/// <summary> /// Update current additional rotation matrix based on the display orientation and color camera orientation. /// /// Not that m_colorCameraPoseRotation will need to compensate the rotation with physical color camera. /// </summary> /// <param name="displayRotation">Orientation of current activity. Index enum is same same as Android screen /// orientation standard.</param> /// <param name="colorCameraRotation">Orientation of current color camera sensor. Index enum is same as Android /// camera orientation standard.</param> public static void UpdatePoseMatrixFromDeviceRotation(OrientationManager.Rotation displayRotation, OrientationManager.Rotation colorCameraRotation) { Tango.OrientationManager.Rotation r = RotateFromAToB(displayRotation, colorCameraRotation); switch (r) { case Tango.OrientationManager.Rotation.ROTATION_90: m_colorCameraPoseRotation = ROTATION90_T_DEFAULT; break; case Tango.OrientationManager.Rotation.ROTATION_180: m_colorCameraPoseRotation = ROTATION180_T_DEFAULT; break; case Tango.OrientationManager.Rotation.ROTATION_270: m_colorCameraPoseRotation = ROTATION270_T_DEFAULT; break; default: m_colorCameraPoseRotation = Matrix4x4.identity; break; } switch (displayRotation) { case Tango.OrientationManager.Rotation.ROTATION_90: m_devicePoseRotation = ROTATION90_T_DEFAULT; break; case Tango.OrientationManager.Rotation.ROTATION_180: m_devicePoseRotation = ROTATION180_T_DEFAULT; break; case Tango.OrientationManager.Rotation.ROTATION_270: m_devicePoseRotation = ROTATION270_T_DEFAULT; break; default: m_devicePoseRotation = Matrix4x4.identity; break; } }
/// <summary> /// Get the world rotation. /// </summary> /// <returns> Quaternion representing the world rotation.</returns> public static Quaternion GetWorldRotation() { return(OrientationManager.GetWorldRotation()); }