[每日一码] 矩形是否相交(包含也算)
bool RectInRect(AcDbExtents &a,AcDbExtents &b){
double minx=max(a.minPoint().x,b.minPoint().x);
double miny=max(a.minPoint().y,b.minPoint().y);
double maxx=min(a.maxPoint().x,b.maxPoint().x);
double maxy=min(a.maxPoint().y,b.maxPoint().y);
return (minx>maxx || miny > maxy) ? false : true;
}
页:
[1]