Here you can find the source of angleFromR(final double[][] R)
Parameter | Description |
---|---|
R | rotation matrix |
public static double angleFromR(final double[][] R)
//package com.java2s; public class Main { /**//w w w . j a va2s .com * compute the angle of rotation from a rotation matrix. The returned value * is in the range [0, PI]. * * @param R * rotation matrix */ public static double angleFromR(final double[][] R) { assert cols(R) >= 3; assert rows(R) >= 3; final double tr = R[0][0] + R[1][1] + R[2][2]; final double theta = Math.acos((tr - 1.0) / 2.0); return theta; } public static int cols(final double[][] A) { return A[0].length; } public static int rows(final double[] a) { return a.length; } public static int rows(final double[][] A) { return A.length; } }