# Centering a polygon on the origin by affine translation

Given a set of tuples, each representing the vertices of a polygon, I would like to center it on the origin. Having calculated the centermost point of the polygon (not the arithmetic centroid) and the distance between it and the origin, how would I go about translating it?

Could I just apply an affine homogeneous translation on the point set$$\begin{bmatrix}1&0&dx\\0&1&dy \\0&0&1\end{bmatrix}$$

where $$dx$$ and $$dy$$ are the distance to the origin? I have a sneaking suspicion that this will not suffice.

• It actually will work just fine. – Parcly Taxel Mar 12 at 3:06
• If your "centermost point" has coordinates $(a,b)$, then all you have to do is subtract $(a,b)$ from each of your vertices. – Gerry Myerson Mar 12 at 3:15
• Are you still here, Tom? – Gerry Myerson Mar 13 at 11:26
• Thanks! Both approaches seem to work just fine, although, without testing, I cannot say which will be most computationally efficient. – Tom Porter Mar 13 at 15:21