Use composition of transformations to find the composite matrix to convert the
object With the points : (2,1), (4,1), (4,3), (2,3)
into the object with the points : ( -3,11), (-2,10), (2,14), (0,15)
public float[] transformX(float[] a, float[] b, int n) {
float[] nX = new float[n];
for(int i = 0; i < n; i ++) {
nX[i] = (a[i] * transformation[0][0]) + (b[i] * transformation[0][1]) + transformation[0][2];
}
return nX;
}
public float[] transformY(float[] a, float[] b, int n) {
float[] nY = new float[n];
for(int i = 0; i < n; i ++) {
nY[i] = (a[i] * transformation[1][0]) + (b[i] * transformation[1][1]) + transformation[1][2];
}
return nY;
}
Comments
Leave a comment