I don't think calculating a rectangle is going to work for you in this case. Think about if you have a triangle and you want to check if it is inside of another triangle. If I draw a rectangle from points on the triangle, that rectangle could always be larger than the area of the triangle, and the rectangle could be partially outside the bounds of the container triangle while the triangle itself is not. If the polygons in question are *regular* polygons, then all you have to do is know all of the vertices and calculate if the vertices are inside of the area of the other. If all of the vertices are inside, then the entire polygon is inside. Unfortunately that is not the case with *irregular* polygons. Are you dealing with potentially irregular polygons?
Check if polygon is inside a polygon?
Yesterday I was looking to check if a point was inside a polygon and found this great script: https://github.com/tparkin/Google-Maps-Point-in-Polygon
But today at work I was told that our client needs to check if one polygon is inside another polygon. I am wondering if there is a formula where I can take, let's say, two coordinates (instead of one to check a point), and from those two coordinates generate a rectangle and check if that rectangle is inside a polygon.
I don't know if I'm asking a stupid question (a teacher in highschool used to say "there are no stupid questions, there are only fools who don't ask"), but if you don't understand me totally but just a bit, I'd be grateful if you just tell me where to start.
Follow
1
Add comment
More
Report
1 Expert Answer
Still looking for help? Get the right answer, fast.
Ask a question for free
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Find an Online Tutor Now
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.