I have a set of polygons, and I need to check whether they are intersecting with a given bounding box(rectangle). What I am doing is, I am taking every vertex of polygon and checking whether it's inside bounding box or not.
If yes
return true
else
Now I am taking every vertex(i.e 4 vertices) of my bounding box and checking whether it is inside polygon or not,
using the algorithm from http://assemblysys.com/php-point-in-polygon-algorithm/
if yes
return true
else
return false(box and polygon are not intersecting)
This way of approaching is taking too much time. I want another algorithm which is faster than this. I tried to search for an answer on Google but was not able to find anything. I tried for finding code of mysql st_intersects() function on github but again I was unable to find that function code.
I know there are many algorithms but, because I am new to this field I was unable to find algorithms,So I used the above approach.