-2

I would like to develop an app that will be used for measuring irregular shapes on your android device's touch screen.

For example,

I have a MotoG3 phone and its screen dimensions are 142.1 x 72.4 x 11.6 mm. I place an eraser of dimensions 15mm* 16mm* 12mm on my phone. I want to build an app which will sense the object placed on its screen and give the dimensions of the object or sense the area covered by the object on the phone.

May I know the Mathematical formula/algorithm to get the full area of the touch screen space?

jewelhuq
  • 1,210
  • 15
  • 19

1 Answers1

0

If you mean calculating the area enclosed by a number of touches, you could use "Shoelace's formula" http://en.wikipedia.org/wiki/Shoelace_formula

Even if the area is delimited by a drag gesture, you could record all intermediate coordinates while dragging, and calculate area using the same formula, as a polygon with a lot of points. The formula is O(n) so the number of points should not be a performance problem.

epx
  • 1,066
  • 9
  • 17