﻿ The Barycentric transformation
 The Barycentric transformation - Basic Concepts The Barycentric transformation is quite similar to the Affine technique explained in section Basic Concepts | Affine, the only difference is that the algorithm performs a barycentric-based calculation which is generally preferred  when the map does not present grid points (map coordinates written on the map itself) and therefore you need to rely on the correspondence between some points on the map that you find and survey in the field. The initial situation is just the same as that of  the Affine transformation, i.e. we need to transform the raster coordinates (origin in the bottom-left vertex) into our survey reference system. So, to explain the different algorithm, let's start from equations (3) of the Affine method for transforming a generic point P:     The Δe and Δn are the (least squares) residuals due to the usual abundance of corresponding points between the raster and the survey, compared to the minimal required number of 2 points. So, let's say that we use k points for the transformation, the equations can be re-written as follows:     Where the symbols in brackets indicate the summation of the respective values for all points. But the value of [Δe] and [Δn] is zero as the effect of applying the least squares theory. So now we want to remove E0 and  N0 from the equations (4) so that we reduce the system to a simple 2 equations with 2 unknowns. It appears evident that the condition at which we can cancel the terms k E0 and  k N0 (i.e. force them to be equal to zero) is that also all the other terms are equal to zero. This condition is achieved when the summations of the coordinates xp yp ep np are also zero. So, how can we force these summations to be zero? Well, by simply substituting the coordinates with their barycentric values. To understand this sentence, let's have a look at the triangle reproduced in     Fig. BC.B1 – The barycenter of a triangle.     If we sum the coordinates of vertices 1, 2, 3 (written in red) we obtain:   [X] = 40 + 140 + 240 = 420 [Y] = 50 + 130 +  30 = 210   Thus the coordinates of the barycenter are:   Xb = 420 / 3 = 140 Yb = 210 / 3 =  70   Now let's move the origin of the axis exactly in the triangle barycenter, the coordinates become those of Fig. BC.B2 and if we sum them again we obtain:   [X] = -100 +  0 + 100 = 0 [Y] =  -20 + 60 + -40 = 0   i.e. the summations of barycentric coordinates are always zero.   Fig. BC.B2 – The summation of barycentric coordinates is always equal to zero.     This also means that the barycentric coordinates of the mutual position of the points in the two systems, the map and the survey, remain unchanged. It follows that, if we substitute in the two equationsthe coordinates x, y, e, n of each point with its barycentric coordinates, we actually remove E0 and  N0 as we wanted. The barycentric coordinates xb yb eb nb of a generic point in the two systems are determined as follows:   where x-y and e-n are the original coordinates and xm ym em nm indicate the coordinate averages, i.e. the coordinates of the barycenter. So now we substitute in the equations (4) the coordinates with their new barycentric values, thus removing E0 and  N0. For simplicity, let's put: so the equations (4) become: As mentioned, now we have only 2 unknowns, fc and fs. So, after a few mathematical steps we can easily calculate them as follows:   If we now sum the squares of these two values, recalling that the sum of the squares of sine and cosine is equal to 1, we obtain the scale factor f: Then, If we divide fs by fc, remembering that the sine divided by the cosine of an angle is its tangent, we obtain the rotation angle ε: Finally from equations (4) and (5) we can obtain the matrix formulas to determine E0 and  N0 from the  coordinate averages and the residuals [Δe] and [Δn] from the barycentric coordinates: In the Transformations | Barycentric section you'll find a practical example on how to perform this transformation with CorrMap.