KiloNet
  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. }  

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2021-11-05
  • 2022-01-28
  • 2021-07-05
猜你喜欢
  • 2022-12-23
  • 2021-12-13
  • 2021-04-30
  • 2022-01-08
  • 2021-11-07
相关资源
相似解决方案