How to compute the union polygon of two (or more) rectangles

后端 未结 4 1630
无人及你
无人及你 2021-02-06 10:10

For example we have two rectangles and they overlap. I want to get the exact range of the union of them. What is a good way to compute this?

These are the two overlappi

4条回答
  •  独厮守ぢ
    2021-02-06 10:47

    Personally I believe this problem should be solved just as all other geometry problems are solved in engineering programs/languages, meshing. So first convert your vertices into rectangular grids of fixed size, using for example: MatLab meshgrid Then go through all of your grid elements and remove any with duplicate edge elements. Now sum the number of remaining meshes and times it by the area of the mesh you have chosen.

提交回复
热议问题