public QuaternionSample(OrientationSensorReading orientationSensorReading, DateTimeOffset _startDateTime) { this.MeasurementTime = orientationSensorReading.Timestamp.Subtract(_startDateTime); this.AngleW = orientationSensorReading.Quaternion.W; this.CoordinateX = orientationSensorReading.Quaternion.X; this.CoordinateY = orientationSensorReading.Quaternion.Y; this.CoordinateZ = orientationSensorReading.Quaternion.Z; }
static Matrix ConvertToMatrix(OrientationSensorReading reading) { return new Matrix { Xx = reading.RotationMatrix.M11, Xy = reading.RotationMatrix.M12, Xz = reading.RotationMatrix.M13, Yx = reading.RotationMatrix.M21, Yy = reading.RotationMatrix.M22, Yz = reading.RotationMatrix.M23, Zx = reading.RotationMatrix.M31, Zy = reading.RotationMatrix.M32, Zz = reading.RotationMatrix.M33 }; }
public static void SetReadingText(TextBlock textBlock, OrientationSensorReading reading) { SensorQuaternion quaternion = reading.Quaternion; // get a reference to the object to avoid re-creating it for each access string quaternionReport = string.Format("W: {0,5:0.00}, X: {1,5:0.00}, Y: {2,5:0.00}, Z: {3,5:0.00}", quaternion.W, quaternion.X, quaternion.Y, quaternion.Z); SensorRotationMatrix rotationMatrix = reading.RotationMatrix; string rotationMatrixReport = string.Format( "M11: {0,5:0.00}, M12: {1,5:0.00}, M13: {2,5:0.00}\n" + "M21: {3,5:0.00}, M22: {4,5:0.00}, M23: {5,5:0.00}\n" + "M31: {6,5:0.00}, M32: {7,5:0.00}, M33: {8,5:0.00}", rotationMatrix.M11, rotationMatrix.M12, rotationMatrix.M13, rotationMatrix.M21, rotationMatrix.M22, rotationMatrix.M23, rotationMatrix.M31, rotationMatrix.M32, rotationMatrix.M33); string yawAccuracyReport; switch (reading.YawAccuracy) { case MagnetometerAccuracy.Unknown: yawAccuracyReport = "unknown"; break; case MagnetometerAccuracy.Unreliable: yawAccuracyReport = "unreliable"; break; case MagnetometerAccuracy.Approximate: yawAccuracyReport = "approximate"; break; case MagnetometerAccuracy.High: yawAccuracyReport = "high"; break; default: yawAccuracyReport = "other"; break; } textBlock.Text = "Quaternion:\n" + quaternionReport + "\n\n" + "Rotation Matrix:\n" + rotationMatrixReport + "\n\n" + "Yaw Accuracy:\n" + yawAccuracyReport; }
internal OrientationSensorReadingChangedEventArgs(OrientationSensorReading reading) { Reading = reading; }
public void setOrientationSensor(OrientationSensorReading reading) { //this. = reading. }
//################################################## Quaternion ##################################################### /// <summary> /// Adds a new orientation sensor reading into the active orientation sensor reading list. /// </summary> /// <param name="orientationSensorReading"></param> public void AddOrientationSensorReading(OrientationSensorReading orientationSensorReading) { if (orientationSensorReading != null) { if (_startDateTime.CompareTo(DateTimeOffset.MinValue) == 0) { _startDateTime = orientationSensorReading.Timestamp; } this.AddQuaternionSample(new QuaternionSample(orientationSensorReading, _startDateTime)); } }