说,我想从矩形板上划出一些矩形板。例如,如何计算一组精确覆盖矩形板矩形板的矩形板
情况1,孔相交:
与孔0,1,2在其中,矩形0和1个相交BORAD X。
xxxxxxxxxxx
xxxxxx222xx
x000xx222xx
x00011222xx
x00011xxxxx
xxx111xxxxx
xxxxxxxxxxx
或更简单的,情况2,无孔相交:
xxxxxxxxxxx
xxxxx2222xx
x00xx2222xx
x00xx2222xx
x00x111xxxx
xxxx111xxxx
xxxxxxxxxxx
后者更像“反转一组矩形的一个大矩形中”。
我的问题是:如何计算一组精确覆盖电路板x的子矩形?
Input: a larger rect, and a set of hole rects
Output: a set of sub rects cover exactly the larger rect with holes
的RECT结构可以像下面CCRect,协调类型为浮动:
typedef struct {float x; float y;} CGPoint;
typedef struct {float width, float height} CGSize;
typedef struct {CGPoint origin; CGSize size;} CGRect;
任何伟大的想法?
hitregions怎么样? –
请提供更多信息。你期望的洞数是多少。你是什么意思的一些小矩形 –
我澄清了一下这个问题。孔的数量不固定,但不是太多。 – smilingpoplar