Share via


SensorManager.GetRotationMatrixFromVector(Single[], Single[]) Method

Definition

Helper function to convert a rotation vector to a rotation matrix.

[Android.Runtime.Register("getRotationMatrixFromVector", "([F[F)V", "")]
public static void GetRotationMatrixFromVector (float[]? R, float[]? rotationVector);
[<Android.Runtime.Register("getRotationMatrixFromVector", "([F[F)V", "")>]
static member GetRotationMatrixFromVector : single[] * single[] -> unit

Parameters

R
Single[]

an array of floats in which to store the rotation matrix

rotationVector
Single[]

the rotation vector to convert

Attributes

Remarks

Helper function to convert a rotation vector to a rotation matrix. Given a rotation vector (presumably from a ROTATION_VECTOR sensor), returns a 9 or 16 element rotation matrix in the array R. R must have length 9 or 16. If R.length == 9, the following matrix is returned:

/  R[ 0]   R[ 1]   R[ 2]   \
              |  R[ 3]   R[ 4]   R[ 5]   |
              \  R[ 6]   R[ 7]   R[ 8]   /

If R.length == 16, the following matrix is returned:

/  R[ 0]   R[ 1]   R[ 2]   0  \
              |  R[ 4]   R[ 5]   R[ 6]   0  |
              |  R[ 8]   R[ 9]   R[10]   0  |
              \  0       0       0       1  /

Java documentation for android.hardware.SensorManager.getRotationMatrixFromVector(float[], float[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to