Monday, 15 March 2010

java - Android: How to get the area size of a drawn path? -


My problem is to measure the surface area of ​​a path
I create a random path and draw it on a canvas I am After touching this clone path, I want to get the area size of this drawn route.

How do I get the actual area size of this path?

Pates (shapes) look like this:

I Found a solution I produce an area from the path and use a field iterator to get the area within the region. With this statement I can calculate the entire area of ​​the path.

  Private Zero Count Area (Area Area) {Area Itater Area Eitator = New Area Iterator (Area); Int size = 0; Rex flap area = 0; Area units // rect tmpRect = new rect (); While (Areaitter. Newcastle (TMPRact)) {Size ++; Area + = tmpRect.width () * tmpRect.height (); } Log.d ("Rect amount =" + size); Log D. ("Area size / area unit =" + area); }    

No comments:

Post a Comment