aihot  2017-05-08 23:50:46  OpenCV |   查看评论   
 1;  
  •     else if(xrectangle<=x&&yrectangle>y&&  
  •         sqrt((x2-x)*(x2-x)+(y1-y)*(y1-y))<=r)  
  •         return 1;  
  •     else if(sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y))<=r)  
  •         return 1;  
  •     //check whether there is one of the four points of the circle is in the rectangle  
  •     if((x-r>=x1&&x-r<=x2||x+r>=x1&&x+r<=x2)&&y>=y1&&y<=y2||  
  •         (y-r>=y1&&y-r>=y2||y+r>=y1&&y+r<=y2)&&x>=x1&&x<=x2)  
  •         return 1;  
  •       
  •     //no case match  
  •     return 0;  
  • }  
  • void main()  
  • {  
  •     printf("%d/n",IsOnRECT(1,1,1,0,0,2,2));  
  •     printf("%d/n",IsOnRECT(1,1,1,2,2,3,3));  
  •  

    除特别注明外,本站所有文章均为 赢咖4注册 原创,转载请注明出处来自矩形和圆的相交检测 算法分析与实现

    留言与评论(共有 0 条评论)
       
    验证码:
    [lianlun]1[/lianlun]