Skip to content

球面数学

¥Spherical math

用于球面几何的低级实用程序。

¥Low-level utilities for spherical geometry.

geoArea(object)

源代码 · 返回指定 GeoJSON 对象在 steradians 中的球面面积。这是 path.area 的球面等效值。

¥Source · Returns the spherical area of the specified GeoJSON object in steradians. This is the spherical equivalent of path.area.

geoBounds(object)

源代码 · 返回指定 GeoJSON 对象的 球形边界框。边界框由一个二维数组表示:[[left, bottom], [right, top]],其中 left 表示最小经度,bottom 表示最小纬度,right 表示最大经度,top 表示最大纬度。所有坐标均以度为单位。(请注意,在投影平面坐标系中,最小纬度通常是最大 y 值,最大纬度通常是最小 y 值。)这是 path.bounds 的球面等效值。

¥Source · Returns the spherical bounding box for the specified GeoJSON object. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) This is the spherical equivalent of path.bounds.

geoCentroid(object)

源代码 · 返回指定 GeoJSON 对象的球面质心。这是 path.centroid 的球面等效值。

¥Source · Returns the spherical centroid of the specified GeoJSON object. This is the spherical equivalent of path.centroid.

geoDistance(a, b)

源代码 · 返回 radians 中两点 a 和 b 之间的大弧距离。每个点必须指定为一个以度为单位的双元素数组 [经度, 纬度]。这是给定两个点的 LineString 后 path.measure 的球面等效值。

¥Source · Returns the great-arc distance in radians between the two points a and b. Each point must be specified as a two-element array [longitude, latitude] in degrees. This is the spherical equivalent of path.measure given a LineString of two points.

geoLength(object)

源代码 · 返回 radians 中指定 GeoJSON 对象的大弧长度。对于多边形,返回外环的周长加上任何内环的周长。这是 path.measure 的球面等效值。

¥Source · Returns the great-arc length of the specified GeoJSON object in radians. For polygons, returns the perimeter of the exterior ring plus that of any interior rings. This is the spherical equivalent of path.measure.

geoInterpolate(a, b)

源代码 · 给定两个点 a 和 b,返回一个插值函数。每个点必须指定为一个以度为单位的双元素数组 [经度, 纬度]。返回的插值器函数接受一个参数 t,其中 t 是一个介于 0 到 1 之间的数字;0 返回点 a,1 返回点 b。中间值沿着穿过 a 和 b 的大圆弧从 a 插入到 b。如果 a 和 b 是对跖点,则选择任意一个大圆弧。

¥Source · Returns an interpolator function given two points a and b. Each point must be specified as a two-element array [longitude, latitude] in degrees. The returned interpolator function takes a single argument t, where t is a number ranging from 0 to 1; a value of 0 returns the point a, while a value of 1 returns the point b. Intermediate values interpolate from a to b along the great arc that passes through both a and b. If a and b are antipodes, an arbitrary great arc is chosen.

geoContains(object, point)

源代码 · 当且仅当指定的 GeoJSON 对象包含指定点时,返回 true;如果该对象不包含该点,则返回 false。该点必须指定为一个二元素数组 [经度, 纬度],单位为度。对于点几何体和多点几何体,使用精确测试;对于球体,始终返回 true;对于其他几何体,应用 epsilon 阈值。

¥Source · Returns true if and only if the specified GeoJSON object contains the specified point, or false if the object does not contain the point. The point must be specified as a two-element array [longitude, latitude] in degrees. For Point and MultiPoint geometries, an exact test is used; for a Sphere, true is always returned; for other geometries, an epsilon threshold is applied.

geoRotation(angles)

源代码 · 返回给定角度的 旋转函数,该角度必须是一个由 [lambda, phi, gamma] 组成的二元或三元数组,用于指定围绕 每个球面轴 的旋转角度(以度为单位)。(这些对应于 偏航、俯仰和滚转。)如果省略旋转角度 gamma,则默认为 0。另请参阅 projection.rotate

¥Source · Returns a rotation function for the given angles, which must be a two- or three-element array of numbers [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. (These correspond to yaw, pitch and roll.) If the rotation angle gamma is omitted, it defaults to 0. See also projection.rotate.

rotation(point) {#_rotation}

源代码 · 返回一个以度为单位的新数组 [经度, 纬度],表示给定点的旋转点。该点必须指定为一个二元素数组 [经度, 纬度],单位为度。

¥Source · Returns a new array [longitude, latitude] in degrees representing the rotated point of the given point. The point must be specified as a two-element array [longitude, latitude] in degrees.

rotation.invert(point) {#rotation_invert}

源代码 · 返回一个以度为单位的新数组 [经度, 纬度],表示给定旋转点的所在位置;rotation 的逆。该点必须指定为一个二元素数组 [经度, 纬度],单位为度。

¥Source · Returns a new array [longitude, latitude] in degrees representing the point of the given rotated point; the inverse of rotation. The point must be specified as a two-element array [longitude, latitude] in degrees.