i would try to develop an application in which i can draw a planimetry. So, each room has got its own ID or name and, if i touch a room, i want to show a Toast Message with that ID or name. The problem is how check if and which path is touched!!
I saw a lot of topic discussions that talked about this problem. Someone says to use getBounds method and, after, contains method for checking if touched point is in Rect. But, i guess getBounds method returns the smallest Rect that contains path, right?
So, rooms have different custom geometric forms and, for this reason, if i get bounds about 2 close rooms, method could return a shared set of points. Bad! Each room has got only their area points. How can i solve this problem ?
In iOS i could use PathContainsPoint method, but, unfortunally, Android Path doesn't have something similar.
I hope someone can help me Thx in advance
Here's a thought: create a new path which is a tiny square around the point that was touched, and then intersect that path with your path to be tested using path.op() and see if the result is empty.
Ok i solved my problem. I post the example code:
As Edward Falk say, best way is to use path.op() becouse Region is square. And one point can be in 2 or 3 Regions. For example: enter image description here All regions will contain blue point, but on fact only path4 contains this point.