poj1410巧妙变成直线与线段相交(二)

2014-11-24 11:21:37 · 作者: · 浏览: 1
leftTopY);

rectSeg[2].point1= Point(rightBottomX,leftTopY);
rectSeg[2].point2= Point(rightBottomX,rightBottomY);

rectSeg[3].point1= Point(rightBottomX,rightBottomY);
rectSeg[3].point2= Point(leftTopX,rightBottomY);

HaveInteraction=false;
for(int i=0;i<4;i++)
{
if(LineInteractSegment(seg,rectSeg[i]))//the line interact with the rectangle, see if the segment interact the rectangle too.
{
if(SegmentInRect(seg, Point(leftTopX,leftTopY), Point(rightBottomX,rightBottomY)))
{
//cout<<"T"< printf("T\n");
HaveInteraction=true;
}
break;
}
}

if(HaveInteraction==false)
{
//cout<<"F"< printf("F\n");
}

}

return 0;
}