Determining polygon intersection and containment

前端 未结 4 1724
借酒劲吻你
借酒劲吻你 2021-02-05 18:09

I have a set of simple (no holes, no self-intersections) polygons, and I need to check that they don\'t intersect each other (one can be entirely contained in another; that is o

4条回答
  •  旧巷少年郎
    2021-02-05 18:44

    Determining whether none of the polygons intersect can be done in O(n*log(n)) by applying the Shamos-Hoey algorithm. Depending on what the Shamos-Hoey algorithm returns, a polygon Pi contains polygon Pj if any vertex from Pj is inside Pi which is done in O(n) for two polygons.

提交回复
热议问题