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

前端 未结 7 1071
时光说笑
时光说笑 2021-02-08 13:49

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:13

    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 }

提交回复
热议问题