Finding the Centre of an Abritary Set of Points in Two Dimensions

You can use the centroid of the points. Imagine you have a set $S$ of $n$ points (in blue in the picture below) $$ S=\{(x_1,y_1),(x_2,y_2),\dots (x_n,y_n)\}$$ Their centroid is given by: $$(\bar x,\bar y) = \left(\frac{1}{n}\sum_{i=0}^n x_i, \frac{1}{n}\sum_{i=0}^n y_i\right).$$

Then, substracting those coordinates to your points $$ S_{(0,0)}=\{(x_1-\bar x,y_1-\bar y),(x_2-\bar x,y_2-\bar y),\dots (x_n-\bar x,y_n-\bar y)\}$$ you will move them towards the origin (in red in the picture below). If you want to translate them to a different point (say, towards point $(a,b)$), then you just need to sum those coordinates to the ones above (in green in the picture below): $$ S_{(a,b)}=\{(x_1-\bar x+a,y_1-\bar y+b),(x_2-\bar x+a,y_2-\bar y+b),\dots (x_n-\bar x+a,y_n-\bar y+b)\}$$

Example

Of course, your program does not need to do both steps separately. You can just apply the last one directly.