1

I am making an Application for a dentist in Java using Swing technology. In my App I want to measure the area of ruff shape,free hand drawn shape,and free hand drawn circle. I also put my teeth image . In this image I have drawn one free hand shape with yellow color and I want to measure area of that circle in java. So, how can I do that? If anyone has an idea about that then please share with me.

enter image description here

Benjol
  • 63,995
  • 54
  • 186
  • 268
Jay
  • 1,235
  • 10
  • 28
  • 49
  • [This question](http://stackoverflow.com/q/2263272/710951) may help. Note that if you have a `Shape` you'll need to convert it to an `Area`. – Alba Mendez May 08 '12 at 11:53
  • this is not work well for my question. i want to calculate any random shape? any one have math's formula for calculate any random shape? – Jay May 08 '12 at 14:35
  • Please, clarify. What do you mean by “random shape”? Will it be polygonal? Can it have beizer curves? From where does the shape come? Why can't you use the print - count pixels technique? – Alba Mendez May 09 '12 at 06:08
  • In above figure i drawn one random shape.and i want to find area of that random shape. how can i use floodfill method for finding area of this random shape? – Jay May 10 '12 at 06:36
  • i done it. i make logic for finding all boundary points and use flood fill method for find area. – Jay May 14 '12 at 04:50
  • Great! Please post an answer explaing how did you solve it and **accept** it. Thanks! – Alba Mendez May 14 '12 at 09:40

1 Answers1

0

Okay, you save each point of the selected line-strip-array as (x1,y1) and (x2,y2) and (x3,y3) .... (xN,yN) then use this formula to get your total enclosed-area:

enter image description here

But be careful, this is an approximation of: "between every 2 points, there is a line"(linear interpolation). Ofcourse, calculation time is proportional to the perimeter-length.

huseyin tugrul buyukisik
  • 11,469
  • 4
  • 45
  • 97