I am trying to do a basic Matrix multiplication with a vector using the static method multiplyMV present in the "Matrix" class in android. Following is a small snippet of the code:
// packaged included
import java.lang.Object;
import android.opengl.Matrix;
public class Example extends Thread
{
float[] R = new float[] {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,0};
float[] inVector = new float[] {1,0,0,0};
public void run()
{
inVector[4] = 2; // edited here // Line 09
Matrix.multiplyMV(inVector , 0, R, 0, inVector , 0); // Line 10
}
}
I am not sure what mistake I am doing, but this code leads to an uncaught exception. I tried to see at what point in the code I am getting this exception. If I put a break point at line10, the execution stops at the line before that, and if I then give a step-into command I again end up with the exception. So the usage of the method is causing this exception but I don't know why. Am I missing some packages? I can't even catch this exception and print stack-trace to see what is happening. Any help is much appreciated!
The context for the code is that it has to perform translations of vectors from one coordinate system to another.
Edit: Exception found: IndexOutOfBounds at line 09
Swap R and inVector in multiplyMV call. Use inVector as lhsMat.