venusdharan / android-gl

Automatically exported from code.google.com/p/android-gl
0 stars 0 forks source link

Error in RotateY function in Class MatrixUtils #18

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Thank you very much for sharing the codes. It tooks me a lot of time to 
understand it, and I found a problem in the rotateY function. I have corrected 
the code, as shown at below:

    public static void rotateY(float[] v, float angle, float[] out) {
        float[][] R = new float[4][4];
        R[0][0] = (float)Math.cos(angle);
        R[0][2] = (float)-Math.sin(angle);
        R[2][0] = (float)Math.sin(angle);
        R[2][2] = (float)Math.cos(angle);
        R[1][1] = R[3][3] = 1;

        multiply(R, v, out);
    }

    public static void rotateX(float[] v, float angle, float[] out) {
        float[][] R = new float[4][4];
        R[1][1] = (float)Math.cos(angle);
        R[1][2] = (float)-Math.sin(angle);
        R[2][1] = (float)Math.sin(angle);
        R[2][2] = (float)Math.cos(angle);
        R[0][0] = R[3][3] = 1;

        multiply(R, v, out);
    }

Original issue reported on code.google.com by sherman...@gmail.com on 29 Mar 2014 at 4:47