I'm in no way a professional programmer so, pls don't expect a sophisticated approach or language here. I'll however appreciate your advice and recommendations to materialize an algorithm which, at a later stage, I could programmatically add to my project... Here is the problem:
Imagine an arbitrary point (Point X) in space with the following properties:
- has coordinates
- lies on a 2D-surface
- is stationary
- belongs to a single area (boundary coordinates of which are also known) at any given time. Namely, it's the only "child" of its "parent" element. Again, if it doesn't sit in one area, it definitely sits inside another one!
An area is NOT a simple square, quadrangle, or a circle but instead is an irregular shape.
Now, my question is: How can I determine: (i) if Point X lies inside that particular area and NOT the adjacent one; (ii) which specific area (among a set of areas A, B, or C) the point belongs to?!? See the linked image to better visualize the problem:
PS: I perused a possibility of dealing with Point in Polygon problem (especially, the "ray casting algorithm" sounds quite smart!) but it doesn't seem to be a solution since (i) areas may be adjacent to each other; (ii) I need to determine the area a point belongs to more than it lies inside/outside of it.
Thank you very much in advance!!!