SphericalDistance[{θ1,ϕ1},{θ2,ϕ2}]
返回单位球面上的点 {θ1,ϕ1} 和 {θ2,ϕ2} 之间的大圆距离.
SphericalDistance[{θ1,1,θ1,2,…,ϕ1},{θ2,1,θ2,2,…,ϕ2}]
返回单位超球表面上任意维度的点之间的测地距离.
SphericalDistance
SphericalDistance[{θ1,ϕ1},{θ2,ϕ2}]
返回单位球面上的点 {θ1,ϕ1} 和 {θ2,ϕ2} 之间的大圆距离.
SphericalDistance[{θ1,1,θ1,2,…,ϕ1},{θ2,1,θ2,2,…,ϕ2}]
返回单位超球表面上任意维度的点之间的测地距离.
更多信息
- 球面或超球面坐标向量使用与 CoordinateChartData 和 CoordinateTransformData 相同的约定,但是去掉了 r 坐标.
- 将 SphericalDistance 的结果乘以半径 r 可以获得半径为 r 的超球体表面上的测地距离.
- 也可以使用 GeoPosition[{lat,lon}] 记法指定二维球面上的点,纬度和经度的单位为度.
- SphericalDistance 可逐项作用于列表中的每个点,SphericalDistance[point,points] 返回距离列表,SphericalDistance[points1,points2] 返回距离矩阵.
- 当处理数值数据时,SphericalDistance 不接受复数输入并且只返回实数输出.
范例
打开所有单元 关闭所有单元基本范例 (3)
SphericalDistance[{Pi / 4, 0}, {Pi / 3, Pi / 4}]SphericalDistance[{0.52, 0.63, 0.78}, {1.05, 1.57, 3.14}]pts = {{Pi / 2, 0}, {Pi / 2, Pi / 2}, {Pi / 2, Pi}, {Pi / 2, 3Pi / 2}}SphericalDistance[{0, 0}, pts]范围 (5)
SphericalDistance 接受精确的数值输入:
SphericalDistance[{Pi / 6, Pi / 5, Pi / 4}, {Pi / 3, Pi / 2, Pi}]SphericalDistance 接受任意精度的数值输入:
SphericalDistance[N[{Pi / 6, Pi / 5, Pi / 4}, 35], N[{Pi / 3, Pi / 2, Pi}, 35]]SphericalDistance 也可处理符号输入:
SphericalDistance[{a, b}, {c, d}]计算矩形 DistanceMatrix,并用 ArrayPlot 显示结果:
SeedRandom[1234];
ArrayPlot[SphericalDistance[RandomReal[Pi, {5, 4}], RandomReal[Pi, {10, 4}]]]SphericalDistance 接受用 GeoPosition[{lat,lon}] 表示的点:
SphericalDistance[GeoPosition[{80.0, 87.0}], GeoPosition[{50.0, 135.3}]]使用一组用 GeoPosition 表示的点:
SphericalDistance[GeoPosition[{{80.0, 87.0}, {50.0, 60.0}}], GeoPosition[{50.0, 135.3}]]应用 (3)
SeedRandom[1234];
pts = RandomReal[Pi / 2, {3, 2}]distances = SphericalDistance@@@Subsets[pts, {2}]AllTrue[{{{1, 2}, 3}, {{2, 3}, 1}, {{3, 1}, 2}}, Function[Greater[Total[distances[[First[#]]]],
distances[[Last[#]]]]]]fun = Function[t, {Pi / 2 + Pi / 4 Cos[2t], t}]curve = N[fun /@ Range[0, 2Pi, 2Pi / 1000]];Graphics3D[{Darker[Blue], Thick,
Line[Transpose[FromSphericalCoordinates[{1, θ, ϕ}] /. {θ -> First[Transpose[curve]], ϕ -> Last[Transpose[curve]]}]], Opacity[.75], LightGray, Sphere[]}, Lighting -> AmbientLight[White],
ViewVertical -> {0, 0, 1}, ViewPoint -> {85, 315, 53}, Boxed -> False
]Total[MapApply[SphericalDistance, Partition[curve, 2, 1]]]octahedron = Join[{{0, 0}, {Pi, 0}}, {Pi / 2, # Pi / 2}& /@ Range[0, 3]]SphericalDistance[First[octahedron], octahedron]SphericalDistance[octahedron, octahedron]SymmetricMatrixQ[%]属性和关系 (5)
SphericalDistance[{Pi / 2, Pi / 5}, {Pi / 2, Pi / 2}]SphericalDistance[{Pi / 5, Pi}, {Pi / 2, Pi}]Pi / 2 - Pi / 5SeedRandom[1234];
{a, b} = RandomReal[Pi, {2, 2}]{p, q} = FromSphericalCoordinates[Prepend[#, 1]& /@ {a, b}]比较 SphericalDistance 和 VectorAngle 的结果:
SphericalDistance[a, b]VectorAngle[p, q]% - %%EuclideanDistance 的结果总是小于 SphericalDistance 的结果:
EuclideanDistance[p, q]SphericalDistance[a, b]stars = {Entity["Star", "Rigel"], Entity["Star", "Betelgeuse"]};AstroGraphics[stars,
AstroReferenceFrame -> "Equatorial", AstroRange -> Quantity[15, "AngularDegrees"]]Apply[SphericalDistance,
Times[{90, 0} - AstroPosition[#, "Equatorial"]["Data"][[{2, 1}]],
Degree]& /@ stars]与 AstroAngularSeparation 的结果相比较:
Normal[AstroAngularSeparation[#1, #2, Entity["Star", "Sun"]]&@@stars ]用 GeoPosition 指定坐标:
p = GeoPosition[{80.0, 87.0}];
q = GeoPosition[{50.0, 135.3}];SphericalDistance[p, q]计算椭圆形地球上的 GeoDistance:
GeoDistance[p, q]Divide[%, Entity["Planet", "Earth"]["Radius"]]SphericalDistance[{a, b}, {c, d}]与 VectorAngle 的结果相比较,在实数上进行化简:
Simplify[VectorAngle[FromPolarCoordinates[{1, a, b}], FromPolarCoordinates[{1, c, d}]], {a, b, c, d}∈Reals]可能存在的问题 (1)
SphericalDistance 的不同用法可能会返回不同的结果:
res1 = SphericalDistance[{a1, a2, a3}, {{b1, b2, b3}}]res2 = SphericalDistance[{a1, a2, a3}, {b1, b2, b3}]First[res1] == res2//Simplify巧妙范例 (1)
tetrahedronPts = Function[{
{#1, #2}, {Pi - #1, -#2}, {Pi - #1, 3#2}, {#1, -3#2}
}][ArcTan[Sqrt[2]], Pi / 4]With[{cartesian = FromSphericalCoordinates[
Prepend[#, 1]]& /@ tetrahedronPts},
Graphics3D[{Line /@ Subsets[cartesian, {2}],
Red, Line[Nest[Riffle[#,
Normalize @* Mean /@ Partition[#, 2, 1]
]&, #, 5]]& /@ Subsets[cartesian, {2}],
LightGray, Opacity[.5], Sphere[]},
Lighting -> AmbientLight[White],
Boxed -> False, ViewVertical -> {0, 0, 1},
ViewPoint -> {2, -3, 4}
]
]SphericalDistance[tetrahedronPts, tetrahedronPts]文本
Wolfram Research (2023),SphericalDistance,Wolfram 语言函数,https://reference.wolfram.com/language/ref/SphericalDistance.html.
CMS
Wolfram 语言. 2023. "SphericalDistance." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/SphericalDistance.html.
APA
Wolfram 语言. (2023). SphericalDistance. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/SphericalDistance.html 年
BibTeX
@misc{reference.wolfram_2026_sphericaldistance, author="Wolfram Research", title="{SphericalDistance}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/SphericalDistance.html}", note=[Accessed: 03-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_sphericaldistance, organization={Wolfram Research}, title={SphericalDistance}, year={2023}, url={https://reference.wolfram.com/language/ref/SphericalDistance.html}, note=[Accessed: 03-November-2026]}