关于 CLLocationAccuracy,大小、精度和接近度如何相互关联
How do magnitude, accuracy, and proximity relate to each other with regards to CLLocationAccuracy
我想知道 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 - 它们之间有什么关系?
准确性只是为您提供有关数据准确性的值。
至少对于 CLLocation,我们使用不同的参数,例如 kCLLocationAccuracyKilometer,等等。文档位于:CLLocation.desiredAccuracy
距离很明显,你离信标有多近(距离:3 +/- 5.39m)在 3 到 5.4 米之间。
一般来说,幅度只是一个绝对值,但不确定它如何适合你的问题...很确定它没用,除非有人能纠正我。
准确度值尝试以米为单位估计距信标的距离。几年前,一位 Apple 支持工程师在一个私人 Apple 论坛上证实了这一点,并且与我的测试一致。 属性 的文档说的是 "one sigma horizontal accuracy in meters where the measuring device's location is referenced at the beaconing device." 这只是意味着 iOS 的最佳猜测是您与信标的距离约为以米为单位的精度值。
近似值只是一个枚举,表示以下值及其原始整数等价物:
unknown 0
immediate 1
near 2
far 3
这些基本上是从精度字段导出的距离 "buckets"。 0-0.5 的精度将使您立即接近。 0.5-3 米的精度值会让你很接近,精度值 > 3 会让你很远。如果无法计算准确度,则返回未知(在这种情况下通常为 returns -1。)
"magnitude" 问题中显示的文档是关于与绝对值相关的数学函数。它与信标无关,与 CLBeacon 的准确性和接近度无关。
我想知道 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 - 它们之间有什么关系?
准确性只是为您提供有关数据准确性的值。
至少对于 CLLocation,我们使用不同的参数,例如 kCLLocationAccuracyKilometer,等等。文档位于:CLLocation.desiredAccuracy
距离很明显,你离信标有多近(距离:3 +/- 5.39m)在 3 到 5.4 米之间。
一般来说,幅度只是一个绝对值,但不确定它如何适合你的问题...很确定它没用,除非有人能纠正我。
准确度值尝试以米为单位估计距信标的距离。几年前,一位 Apple 支持工程师在一个私人 Apple 论坛上证实了这一点,并且与我的测试一致。 属性 的文档说的是 "one sigma horizontal accuracy in meters where the measuring device's location is referenced at the beaconing device." 这只是意味着 iOS 的最佳猜测是您与信标的距离约为以米为单位的精度值。
近似值只是一个枚举,表示以下值及其原始整数等价物:
unknown 0
immediate 1
near 2
far 3
这些基本上是从精度字段导出的距离 "buckets"。 0-0.5 的精度将使您立即接近。 0.5-3 米的精度值会让你很接近,精度值 > 3 会让你很远。如果无法计算准确度,则返回未知(在这种情况下通常为 returns -1。)
"magnitude" 问题中显示的文档是关于与绝对值相关的数学函数。它与信标无关,与 CLBeacon 的准确性和接近度无关。