Hi, I'm stuck with this custom perspective matrix thing.
I would like to perform a custom perspective transformation (exactly like Gimp's perspective tool). Actually, I want to map a quad (the applet window) to another quad (arbitrary coordinates). I am using Sun's Java Advanced Imaging (JAI) library since it seems to provide all needed methods for such things.
The problem is, I reset the matrix and apply the matrix I just got from JAI, and I've got this ArrayIndexOutOfBoundsException. If I don't reset the matrix before applying the new one, I don't get expected results either.
Here is the matrix JAI is returning and that I would like to apply :
Code:Perspective transform matrix
90000.0 0.0 6000000.0
0.0 80000.0 6000000.0
0.0 0.0 120000.0
Here is what I get with
printMatrix() after reseting and applying (looks ok) :
Code:0090000,0000 0000000,0000 6000000,0000 0000000,0000
0000000,0000 0080000,0000 6000000,0000 0000000,0000
0000000,0000 0000000,0000 0120000,0000 0000000,0000
0000000,0000 0000000,0000 0000000,0000 0000001,0000
My window's dim are 400 x 300 and I've got this exception (looks like an overflow) :
Code:java.lang.ArrayIndexOutOfBoundsException: 120200
at processing.core.PLine.drawLine_plain_spatial(PLine.java:762)
...
What's wrong?