Sets matrix m to the identity matrix. - Android java.lang

Android examples for java.lang:Math Matrix

Description

Sets matrix m to the identity matrix.

Demo Code


//package com.java2s;

public class Main {
    /**//  ww w .jav  a 2 s . c  om
     * Sets matrix m to the identity matrix.
     * 
     * @param sm returns the result
     * @param smOffset index into sm where the result matrix starts
     */
    public static void setIdentityM(float[] sm, int smOffset) {
        //android.util.Log.d(TAG,"setIdentityM()");
        sm[smOffset + 1] = sm[smOffset + 2] = sm[smOffset + 3] = sm[smOffset + 4] = sm[smOffset + 6] = sm[smOffset + 7] = sm[smOffset + 8] = sm[smOffset + 9] = sm[smOffset + 11] = sm[smOffset + 12] = sm[smOffset + 13] = sm[smOffset + 14] = 0;
        sm[smOffset + 0] = sm[smOffset + 5] = sm[smOffset + 10] = sm[smOffset + 15] = 1f;
    }
}

Related Tutorials