Algorithm required to determine if a rectangle is completely covered by another set of rectangles

前端 未结 7 2271
轻奢々
轻奢々 2021-02-08 13:45

I am searching for an algorithm that will determine if a new rectangle is completely covered by a set of existing rectangles. Another way of putting the question, is does the ne

7条回答
  •  悲哀的现实
    2021-02-08 14:19

    Try this

    Source Rectangle : X0, Y0, breadth, height

    // Basically comparing the edges

    if(((X0 >= xi) && (X0+breadth <= Xi)) && ((Y0 >= Yi)&&(Y0+height <= Yi)) { //consider the rectangle } else { // discard }

提交回复
热议问题