1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Finished test code, added image to the doc

This commit is contained in:
Nghia Ho
2013-07-31 23:08:02 +10:00
parent 27bcc0bf07
commit 00f63fa8f7
2 changed files with 58 additions and 0 deletions
+28
View File
@@ -61,6 +61,34 @@ int rotatedRectangleIntersection( const RotatedRect& rect1, const RotatedRect& r
int ret = INTERSECT_FULL;
// Specical case of rect1 == rect2
{
bool same = true;
for( int i = 0; i < 4; i++ )
{
if( fabs(pts1[i].x - pts2[i].x) > samePointEps || (fabs(pts1[i].y - pts2[i].y) > samePointEps) )
{
same = false;
break;
}
}
if(same)
{
intersection.resize(4);
for( int i = 0; i < 4; i++ )
{
intersection[i] = pts1[i];
}
Mat(intersection).copyTo(intersectingRegion);
return INTERSECT_FULL;
}
}
// Line vector
// A line from p1 to p2 is: p1 + (p2-p1)*t, t=[0,1]
for( int i = 0; i < 4; i++ )