gpt4 book ai didi

ios - 关于 CLLocationAccuracy,大小、精度和接近度如何相互关联

转载 作者:行者123 更新时间:2023-11-28 18:47:16 25 4
gpt4 key购买 nike

我想知道 CLLocationAccuracy 对象的幅度值是否表示以米为单位的距离。在Xcode文档中是这样描述的:

Description: The magnitude of this value. //this value being accuracy value?

For any value x, x.magnitude.sign is .plus. If x is not NaN, x.magnitude is the absolute value of x. The global abs(:) function provides more familiar syntax when you need to find an absolute value. In addition, because abs(:) always returns a value of the same type, even in a generic context, using the function instead of the magnitude property is encouraged.

Listing 1 let targetDistance: Double = 5.25 let throwDistance: Double = 5.5

let margin = targetDistance - throwDistance // margin == -0.25 // margin.magnitude == 0.25

// Use 'abs(_:)' instead of 'magnitude' print("Missed the target by (abs(margin)) meters.") // Prints "Missed the target by 0.25 meters."

震级与距离有什么关系(如果有的话)?我可以看到它与原始 proximity 值不同,因为它高于 3。

例如(来自测试的控制台输出):

[CLBeacon (uuid:12345678-B644-4520-8F0C-720EAF059935, major:1, minor:3, proximity:3 +/- 5.39m, rssi:-71)] //a beacon that is being ranged
major: 1
minor: 3
accuracy: 5.38695083568272

2.64546246474154 --- magnitude

您可以看到精度为 5.3869...接近度值为 3...幅度为 2.6454 - 它们之间有什么关系?

最佳答案

准确度值尝试估计距信标的距离(以米为单位)。几年前,一位 Apple 支持工程师在一个私有(private) Apple 论坛上证实了这一点,并且与我的测试一致。该属性的文档说的是“以米为单位的一个西格玛水平精度,其中测量设备的位置在信标设备上被引用。”这只是意味着 iOS 的最佳猜测是你与信标是关于以米为单位的精度值。

邻近值只是一个枚举,表示以下值及其原始整数等价物:

unknown      0
immediate 1
near 2
far 3

这些基本上是从精度字段派生的距离“桶”。 0-0.5 的精度将使您立即接近。 0.5-3 米的精度值会让你很接近,精度值 > 3 会让你很远。如果无法计算准确度,则返回未知(在这种情况下通常返回 -1。)

“量级”问题中显示的文档是关于与绝对值相关的数学函数。它与信标无关,与 CLBeacon 的准确性和接近度无关。

关于ios - 关于 CLLocationAccuracy,大小、精度和接近度如何相互关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49201527/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com