Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
2つのオブジェクトからの衝突を検出しようとしています。この衝突には複数のオプションがあるので、半径などを宣言する方法があるかどうか知りたいですCGPoint。
CGPoint
これは、ポイントが円の中にあるかどうかをテストする簡単な方法です。
-(bool)pointInCircle_circleCenter:(CGPoint)circleCenter circleRadius:(float)radius testPoint:(CGPoint)point{ float distance = (circleCenter.x-point.x) * 2 + (circleCenter.y-point.y) * 2; return distance <= radius * 2; }