I tried the Internet for several days, but could not find a good answer (or at least the one that made sense to me) to what seems to be a general question. How can I scale an arbitrary polygon? In particular, concave polygons. I need an algorithm that can handle concave (definitely) and self-intersecting (if possible) polygons. The obvious and simple algorithm that I used to process simple convex polygons calculates the center of gravity of the polygon, translating it to the origin, scaling all the vertices and translating the polygon back to its original location.
This approach does not work for many (or maybe all) concave polygons, since the centroid often goes beyond the polygon, so the zoom operation also leads to a translation, and I need to be able to scale the polygon "in place" without the final translation result.
Does anyone know of a method for scaling concave polygons? Or maybe a way to find a "visual center" that can be used as a frame of reference for a zoom operation?
Just to clarify, I work in 2D space, and I would like to scale my polygons using the "visual center" as a reference system. So maybe another way to ask a question: how to find the visual center of a concave and / or self-intersecting polygon?
Thank!
Craig source
share