domingo, 1 de mayo de 2022

Shape detection (square, equilateral triangle and circle)

Three shapes are going to be recognised through a formula that manages the square, the triangle or the circle itself over a relative area to its circumscribed circle.

Then, 

  • if the result of substraction is 36%, the original area is a square
  • if the area resulting is a 58% then the shape is an equilateral triangle
  • Finally, if all the area is substracted and results 0%, the shape is the circle itself.  
See below the details on formulae: 





In addition to this, it is required to define the center from three points at least. Thus, we determine the center. This point is called centroid. The algorith to get
 is https://stackoverflow.com/questions/4103405/what-is-the-algorithm-for-finding-the-center-of-a-circle-from-three-points

From an image, where blue color has been scanned, we can get min and max from x scan and just min from y scan. 
Although we already know which the area should be, we need determining three points at least.

Let's make a revision on PVector in Processing. Once more, Schiffman teaches us how to do it.



No hay comentarios:

Publicar un comentario