更新时间:2021-11-14 23:06:53
这是一个能为你做的功能。这来自Apple的Adventure示例代码:
Here's a function that will do it for you. This is from an Apple's Adventure example code:
CGFloat SDistanceBetweenPoints(CGPoint first, CGPoint second) {
return hypotf(second.x - first.x, second.y - first.y);
}
要从您的代码中调用此函数:
To call this function from your code:
CGFloat distance = SDistanceBetweenPoints(nodeA.position, nodeB.position);