Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a set of x, y co-ordinates that are actually taken from hand drawings of a circle, square or a triangle. Using the set of points, I need to mathematically find if the points approximately fit a square, circle or a triangle. What is the ideal way to implement this case?

share|cite|improve this question
Are you looking for a computational solution? This generally belongs to the field of machine learning/pattern recognition in computer science, and is often performed as OCR (Optical Character Recognition). The most common approach is to train your algorithm on many samples of each of the handwritten characters, find a common mathematical pattern and use that for prediction. – Bitwise Oct 7 '12 at 3:46

Calculate all the slopes between pairs of points, and order them. If there are two numbers that show up repeatedly in your list, you've got a square; three, a triangle; none; a circle.

This assumes that the given points are many in number and sampled randomly from the drawing.

share|cite|improve this answer

You also could use Hough transform. There are large number of this implementation of different programming languages. For more clearness, I post link with web example here.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.