geometry - Using Python, how do I tell if a rectangle and a shape overlap? -
i'm writing program in python. have series of shapes (polygons, defined sequence of coordinate pairs) , need tell if overlap particular rectangle.
is there easy algorithm handling this? or, better, there pure python library can handle these calculations me?
presuming "arbitrary shapes" indeed polygons (given they're described coordinate pairs), determining if overlap (in language) relatively trivial calculation. merely need compute if side of polygon intersects other side of polygon b.
if need example, there's rather thorough walkthrough @ the drexel math forum.
there number of python modules can assist in pursuit, such sympy, numpy, pygame, etc., of them rather heavy if geometric calculation need make.
Comments
Post a Comment