0

I'm trying to write a small drawing app where I want to be able to draw shapes by hand and the app will identify the kind of shape and redraw it using vector graphics.

Supposing that I have a list of 2D points that represent the following image:

enter image description here

What algorithms should I use in order to:

  1. Determine that the shape is a square and not another shape or curve/arc;
  2. Determine the edges of the square
Mikhas
  • 851
  • 1
  • 12
  • 31
  • Your sample image has a smooth line. Are you sure it consists of 2D point, like 1000s of them? You asking how to determine the kind and edges of a shape from 1000s of 2D points? – Kromster Aug 16 '22 at 05:46
  • Yes, you are correct: the source image will be a hand draws shape created with an input device such as a stylus, touch or mouse pointer over a canvas. – Mikhas Aug 16 '22 at 07:26
  • 1. Can you circumscribe all shapes and one that leaves the least outer space is the closest to it? – Sandro J Aug 17 '22 at 00:55
  • see [How to compare two shapes?](https://stackoverflow.com/a/22166032/2521214) and [Catmull-Rom interpolation on SVG Paths](https://stackoverflow.com/a/30750626/2521214) – Spektre Aug 17 '22 at 06:53
  • @SandroJ, yes: I can isolate the points for each shape and analyze individually. – Mikhas Aug 17 '22 at 08:05

0 Answers0