* each transformation parameter (sx, sy, sxy, phi, tx,ty). The rows are derivations of fx and fy.
*
* @return A matrix
*/
protected GeneralMatrix getA() {
GeneralMatrix A = new GeneralMatrix(2 * this.getMappedPositions().size(), 6);
double cosphix = Math.cos(phix);
double sinphix = Math.sin(phix);
double cosphiy = Math.cos(phiy);
double sinphiy = Math.sin(phiy);
/**
* Each row is calculated with values of proper GCPs
*/
for (int j = 0; j < (A.getNumRow() / 2); j++) {
double x = getSourcePoints()[j].getOrdinate(0);
double y = getSourcePoints()[j].getOrdinate(1);
/*************************
*
* Derivation X
*
**************************/
double dxsx = cosphix*x;
double dxsy = - sinphiy * y;
double dxphix = -sx*sinphix* x;
double dxphiy = -sy*cosphiy* y ;
double dxtx = 1;
double dxty = 0;
/*************************
*
* Derivation Y
*
***********************/
double dysx = sinphix * x;
double dysy = cosphiy * y;
double dyphix = sx*cosphix*x;
double dyphiy = -sy*sinphiy* y ;
double dytx = 0;
double dyty = 1;
A.setRow(j, new double[] { dxsx, dxsy, dxphix, dxphiy, dxtx, dxty });
A.setRow(A.getNumRow()/2 + j, new double[] { dysx, dysy, dyphix, dyphiy, dytx, dyty });
}
return A;
}