天堂向右,我依然向左

天下之大,虽离家千里,何处不可往!何事不可为!
生活之路,纵坎坷曲折,当奋斗不息,则精彩纷呈!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  1. - (BOOL) pointInside:(CGPoint)point withEvent:(UIEvent *)event   
  2. {  
  3. CGPoint pt;  
  4. float HALFSIDE = SIDELENGTH / 2.0f;  
  5. // normalize with centered origin  
  6. pt.x = (point.x - HALFSIDE) / HALFSIDE;  
  7. pt.y = (point.y - HALFSIDE) / HALFSIDE;  
  8. // x^2 + y^2 = radius  
  9. float xsquared = pt.x * pt.x;  
  10. float ysquared = pt.y * pt.y;  
  11. // If the radius < 1, the point is within the clipped circle  
  12. if ((xsquared + ysquared) < 1.0return YES;  
  13. return NO;  
  14. }  
posted on 2010-08-24 15:46  老舟  阅读(418)  评论(0编辑  收藏  举报