ee.Number.hypot

计算二维向量 [x, y] 的模。

用法返回
Number.hypot(right)数字
参数类型详细信息
此:left数字左侧值。
right数字右侧值。

示例

代码编辑器 (JavaScript)

// Left input is x and right input is y, representing point (x,y).
print('Length from origin to point (0,0)', ee.Number(0).hypot(0));  // 0
print('Length from origin to point (3,0)', ee.Number(3).hypot(0));  // 3
print('Length from origin to point (3,4)', ee.Number(3).hypot(4));  // 5
print('Length from origin to point (-3,4)', ee.Number(-3).hypot(4));  // 5
print('Length from origin to point (-3,-4)', ee.Number(-3).hypot(-4));  // 5

Python 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

# Left input is x and right input is y, representing point (x,y).
# 0
print('Length from origin to point (0,0):', ee.Number(0).hypot(0).getInfo())
# 3
print('Length from origin to point (3,0):', ee.Number(3).hypot(0).getInfo())
# 5
print('Length from origin to point (3,4):', ee.Number(3).hypot(4).getInfo())
# 5
print('Length from origin to point (-3,4):', ee.Number(-3).hypot(4).getInfo())
# 5
print('Length from origin to point (-3,-4):', ee.Number(-3).hypot(-4).getInfo())