OrientationEvent class

Represents an orientation event detected by sensors, providing information about the orientation of the device.

The device's coordinate system is defined relative to the screen in its default orientation. It remains unchanged when the device's screen orientation changes.

  • X axis: Horizontal and points to the right.
  • Y axis: Vertical and points up.
  • Z axis: Points towards the outside of the front face of the screen. Coordinates behind the screen have negative Z values.

The world coordinate system is defined as a direct orthonormal basis:

  • x axis: Defined as the vector cross product y⨯z. It is tangential to the ground at the device's current location and roughly points East.
  • y axis: Tangential to the ground at the device's current location and points towards magnetic north.
  • z axis: Points towards the sky and is perpendicular to the ground.

A right-handed reference frame is adopted, with the right-hand rule used to determine the sign of the angles.

Constructors

OrientationEvent({required Quaternion quaternion, required double accuracy, required int timestamp})
Constructs an OrientationEvent with the given quaternion, accuracy, and timestamp. The coordinateSystem is initialized to the identity matrix, representing the device's default coordinate system.

Properties

accuracy double
An estimated accuracy of the sensor data (in radians). The actual device orientation is expected to be within this margin of error. If the accuracy is unavailable, this value is -1. Accuracy information was introduced in Android SDK level 18, but not all devices support it. For iOS devices, this is always -1.
final
coordinateSystem Matrix3
The coordinate system in which the orientation is expressed, represented as a 3x3 matrix.
final
eulerAngles EulerAngles
The orientation of the device represented as euler angles (azimuth, pitch, roll).
no setter
hashCode int
The hash code for this object.
no setterinherited
quaternion Quaternion
The orientation of the device represented as a quaternion.
final
rotationMatrix Matrix3
The orientation of the device represented as a rotation matrix.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timestamp int
The timestamp at which the event was recorded, in microseconds since some arbitrary point in time, usually the time of system boot.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remapCoordinateSystem(Axis3 newX, Axis3 newY) OrientationEvent
Remaps the device coordinate system of this OrientationEvent to a new coordinate system defined by the specified 'newX' and 'newY' axes.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited