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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.