I have a 2d polygon that consists of a list with points, i want to check wether a given point lies in that polygon, but i cant find a good way to check this.
Can anyone point me in the right direction?
http://en.wikipedia.org/wiki/Point_in_polygon
http://alienryderflex.com/polygon/
this is a very very clear guide how to do that, inclusive a implementation in C
Related
I have a region table in oracle 12c, the table include 9 region that each of them defined by a polygon.
Polygon defined by 4 points in 2D.
I give a point from client and I must find out that this point is in which polygon. can anyone help me with this problem?
by the way I use Oracle 12c.
Ray casting algorithm is a popular solution to your problem https://en.wikipedia.org/wiki/Point_in_polygon. You can find pseudo-code easily and can start from that.
If you want to have solution in a specific language, then sorry I can't be of help.
I have a point p and multiple circles C1,C2,C3.... Cn.
How can i find if the point is at the intersection area of this Circles ?
I just know the center(x,y) and the radius of the circles C1...Cn and the coordinates of the point p(x,y).
I have to write a cpp code for implementing this problem.
But at first i need to know the logic. Please help.
Just check if the distances of the point from the three centers are less of all the three radius.
EDIT: homework? I should not have answered :/
I am trying to implement a ear clipping algorithm into a program of mine but I am having issues. While that I can get it to work in a lot of situations, I haven't found a good way to check for reflex angles.
I've been looking up ways - every method I've tried to date seems to have angle it won't work for. When I try to find more information, most people's tutorials/work just tell me to "find the reflex angle and test for ear" then describe how to test for ear but not how to get the reflex angle.
Can anyone tell me how to get the proper angle inside the triangle for a concave polygon, or point me in the right direction? Could be an understanding issue with me. Thanks.
Figured out my problem was one of how I was conceiving the issue. I was saying that if the point was outside the polygon it could still be in the polygon without adding in my head the fact I removed the last vertex. Been busting my brains trying to implement ear clipping for a few days and got it wrong at this point - the solution was the basic "check if the center point of the triangle was outside the polygon and mark it as reflex".
I have a list of points with latitude and longitude coordinates, from which I want to enter a point say X. I need help coming up with an algorithm to determine the closest 3 list members to that point x.
You'll probably have to use the Haversine Formula. It calculates Great Circle distance between two points on the Earth's surface. Here's a good article explaining that, and here's an answer to a question similar to yours. Hope that helps!
See the method computeDistanceBetween() in the google.maps.geometry.spherical namespace:
https://developers.google.com/maps/documentation/javascript/reference#spherical
Then, here's an old V2 demo that uses Array.sort():
http://maps.forum.nu/gm_array_sort.html
You could combine the two, implementing
computeDistanceBetween() instead of compareDistance() as the sorting function.
Note that this is all done client side.
I wonder if someone can help me to find the area of a 2-D object in Cartesian plane , when we know coordinates of every points.
Eg : I want to calculate the area of a triangular. A(12,34) B(45,89) C(25,35)
I want a common algorithm to find any 2-D object's area.
Thank you.
Here you go, uses triangulation. This was literally the top result off Google when I searched "area of polygon given set of points". Please do your research before posting.
If your object is a simple polygon, there's no need to triangulate it to compute its area. There's a simple formula that depends only on the coordinates of the vertices. See http://en.wikipedia.org/wiki/Polygon#Area_and_centroid