I'm trying to design a method to represent polygons as vectors. There are many ways to do this, but I have a few goals and I'm not sure what representation is best to fulfil these. The objectives are:

  • I want there to be a simple (efficiently computable) distance function between polygons that gives a measure of how different the contained region of two polygons are.

  • The function does not have to be completely invertible or one-to-one, but it should be possible to reconstruct something close to the original from it.

  • The vector for the representation should be the same dimension no matter the polygon.

This might seem a bit strange but I'll give an example of what I mean. The best way I've been able to come up with is to send out "rays" from the centroid of the polygon in even angular intervals. I then measure the length of these rays always starting from the same direction and going counter clockwise. The lengths become my vector representation of the shape.

I think this easy algorithm works fairly well but it has a few flaws. I'm using the euclidean distance between the vectors as my distance function and I'm not sure how well it really works. Also, as seen in the picture where the blue circle is, concave shapes can give rise to awkward situations like this where I'm not sure where to stop the ray.

Maybe it's also helpful to know why I need this. It will be used to find the most similar polygon in a database to a specific shape.

My question is just if you know of, or can come up with, a better or simpler way to do this representation than the one I have.

Thank you!



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.