问题描述
是否有任何已知的方法来计算两个矩形的交集矩形?我的意思是,如果矩形A被(X1,Y2,X2,Y2)和B由(X3,Y3,X4,Y4),我该如何计算交会矩形C的坐标定义(X5,Y5,5233,Y6 )?
Is there any known approach to compute the intersection rectangle between two rectangles? I mean if the rectangle A is defined by (x1,y2, x2,y2) and B by (x3,y3, x4,y4), how do I compute the coordinates of the intersection rectangle C (x5,y5, x6,y6)?
感谢。
推荐答案
相交多边形的普遍问题进行了详细说明如下:的。顺便说一句,对于任务的最佳库,与绑定几种编程语言之一,是GPC - 通用多边形快船库:的
The general problem of intersecting polygons is explained in detail in here: http://davis.wpi.edu/~matt/courses/clipping . Incidentally, one of the best libraries for the task, with bindings for several programming languages, is GPC - the General Polygon Clipper library: http://www.cs.man.ac.uk/~toby/alan/software
这篇关于矩形交集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!