matlab function rectint

SHIT!

MATLAB function "rectint"

I don not know that the function "rectint" have this performance!

I waste a lot of time to write a new function in my projection. Now introduce it

RECTINT 矩形相交函数。

     AREA = RECTINT(A,B) 返回的矩形相交部分的面积。

     A和B是按位置向量指定的矩形

     如果A和B各指定一个长方形,面积是一个标量。

     A和B也可以是矩阵,其中每行是一个位置向量。那么返回的AREA是一个矩阵,是提供的所有矩形与 由A 或 B指定的矩形相交部分的面积 。也就是说,如果A指定的矩形 是M × 4和B为N × 4,然后AERA是一个m × n矩阵,在面积(P,Q)是由指定的矩形面积来自 P 行的 A 和 Q 行的 B ,

   注:位置向量是一个四元向量 [X,Y,宽度,高度], 这个X和Y指定矩形左下方的那个顶点的坐标宽度和高度意思是分别沿x轴 和Y轴的大小。

 

例:>> axes('xlim',[0 10],'ylim',[0 10])
>> a = [1 1 2 2];
>> b = [3 4 5 6];
>> rectangle('position',a)
>> rectangle('position',b)
>> c = [1 1 3 3];
>> rectangle('position',c)
>> rectint(a,c)

ans =

4

>> rectint(b,c)

ans =

0

>> rectint(a,b)

ans =

0

>> d = [a;b];
>> rectint(d,c) % 矩阵的情况

ans =

4
0

>>

 

原文地址:https://www.cnblogs.com/CBDoctor/p/2264843.html