Android examples for java.lang:Math Matrix
Returns the transpose of a 4x4 matrix
//package com.java2s; public class Main { /**// www . j av a 2 s. co m * Returns the transpose of a 4x4 matrix * @param m The matrix to transpose * @param result The place to store the transposed matrix **/ public static void transpose(float[][] m, float[][] result) { for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) result[j][i] = m[i][j]; } public static void transpose(float[] m, float[] result) { for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) result[j * 4 + i] = m[i * 4 + j]; } }