Anúncio: todos os projetos não comerciais registrados para usar o Earth Engine antes de
15 de abril de 2025 precisam
verificar a qualificação não comercial para manter o acesso ao Earth Engine.
ee.Number.hypot
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Calcula a magnitude do vetor 2D [x, y].
Uso | Retorna |
---|
Number.hypot(right) | Número |
Argumento | Tipo | Detalhes |
---|
isso: left | Número | O valor à esquerda. |
right | Número | O valor à direita. |
Exemplos
Editor de código (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
Configuração do Python
Consulte a página
Ambiente Python para informações sobre a API Python e como usar
geemap
para desenvolvimento interativo.
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())
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-07-26 UTC.
[null,null,["Última atualização 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eNumber.hypot()\u003c/code\u003e calculates the magnitude (or length) of a 2D vector defined by coordinates \u003ccode\u003ex\u003c/code\u003e (left input) and \u003ccode\u003ey\u003c/code\u003e (right input).\u003c/p\u003e\n"],["\u003cp\u003eIt effectively computes the distance from the origin (0,0) to the point (x,y) in a 2D plane.\u003c/p\u003e\n"],["\u003cp\u003eThe result returned is a number representing the calculated magnitude/distance.\u003c/p\u003e\n"],["\u003cp\u003eExamples demonstrate its usage with various coordinate combinations, illustrating consistent magnitude calculation regardless of sign.\u003c/p\u003e\n"]]],["The `hypot` method calculates the magnitude of a 2D vector. It takes two numeric arguments, `left` (x-value) and `right` (y-value), and returns a `Number` representing the distance from the origin (0,0) to the point (x,y). The examples demonstrate that inputs of (0,0), (3,0), (3,4), (-3,4), and (-3,-4) result in magnitudes of 0, 3, 5, 5, and 5, respectively. The function is available in both JavaScript and Python.\n"],null,["# ee.Number.hypot\n\nCalculates the magnitude of the 2D vector \\[x, y\\].\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------|---------|\n| Number.hypot`(right)` | Number |\n\n| Argument | Type | Details |\n|--------------|--------|-----------------------|\n| this: `left` | Number | The left-hand value. |\n| `right` | Number | The right-hand value. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Left input is x and right input is y, representing point (x,y).\nprint('Length from origin to point (0,0)', ee.Number(0).hypot(0)); // 0\nprint('Length from origin to point (3,0)', ee.Number(3).hypot(0)); // 3\nprint('Length from origin to point (3,4)', ee.Number(3).hypot(4)); // 5\nprint('Length from origin to point (-3,4)', ee.Number(-3).hypot(4)); // 5\nprint('Length from origin to point (-3,-4)', ee.Number(-3).hypot(-4)); // 5\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Left input is x and right input is y, representing point (x,y).\n# 0\nprint('Length from origin to point (0,0):', ee.Number(0).hypot(0).getInfo())\n# 3\nprint('Length from origin to point (3,0):', ee.Number(3).hypot(0).getInfo())\n# 5\nprint('Length from origin to point (3,4):', ee.Number(3).hypot(4).getInfo())\n# 5\nprint('Length from origin to point (-3,4):', ee.Number(-3).hypot(4).getInfo())\n# 5\nprint('Length from origin to point (-3,-4):', ee.Number(-3).hypot(-4).getInfo())\n```"]]