How can I define closeness of these geometric shapes

593 Views Asked by At

Given points on a 2D plane, what kind of metrics can be used to define if they closely fit either:

  • triangle
  • square or rectangle
  • circle
  • oval (circular but not oval)

enter image description here

(Image credit: StyleCraze.com "How to Determine the Shape of Your Face".)

Note thanks to John Gowers on Meta for trying to help clarify parts of my old question, which was closed.

2

There are 2 best solutions below

0
On

All of these shapes can be parameterized by a small set of parameters (assuming that you mean "ellipse" when you say "oval"). For example, a square can be parameterized by a side length and an angle of rotation: 2 parameters. You can create four different optimization algorithms, one for each shape. Each algorithm fits a shape to the set of points. For these algorithms, you will need to choose an optimization metric. An example might be the sum of distances between points and nearest location of shape. The residual (the best value of the optimization metric) will tell you how well each shape fits the set of points. The shape with the lowest metric fits the set of points best.

4
On

The four shapes given are all examples of (boundaries of) 2-dimensional convex bodies, so any metric on arbitrary convex bodies will do. Some examples include the following, where $C,D$ are $d$-dimensional convex sets in Euclidean space:

  1. Hausdorff metric: $d(C,D)= \max\left\{\sup\limits_{x \in X}\inf\limits_{y \in Y}~d(x,y),~\sup\limits_{y \in Y}\inf\limits_{x \in X}d(x,y)\right\}$ where $d(x,y)$ is the Euclidean distance function.
  2. Symmetric difference metric: $\Delta_v(C,D)= v (C \cup D) - v (C \cap D)$, where $v$ is Euclidean volume in $\mathbb{E}^d$. See page 1 of this paper and this section of the symmetric difference wiki page.
  3. Symmetric surface area deviation: $\Delta_s(C,D)= s(C \cup D) - s(C \cap D)$, where $s$ is the surface area. See page 1 of this paper.

Note: The symmetric surface area deviation does not satisfy the triangle inequality, so is not technically a metric, but rather a deviation measure.

Note: One can replace the continuous volume in (2) with discrete approximations and still have a metric.