Example usage for org.apache.commons.math3.complex Quaternion normalize

List of usage examples for org.apache.commons.math3.complex Quaternion normalize

Introduction

In this page you can find the example usage for org.apache.commons.math3.complex Quaternion normalize.

Prototype

public Quaternion normalize() 

Source Link

Document

Computes the normalized quaternion (the versor of the instance).

Usage

From source file:com.diozero.api.imu.ImuDataFactory.java

public static Quaternion createQuaternion(int[] quat, double scale) {
    // This article suggests QUAT_W is [0]
    // https://github.com/vmayoral/bb_mpu9150/blob/master/src/linux-mpu9150/mpu9150/mpu9150.c
    Quaternion quaterion = new Quaternion(quat[MPU9150_QUAT_W] * scale, quat[MPU9150_QUAT_X] * scale,
            quat[MPU9150_QUAT_Y] * scale, quat[MPU9150_QUAT_Z] * scale);
    return quaterion.normalize();
}