ee.Number.hypot
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
قدر بردار 2 بعدی [x, y] را محاسبه می کند.
استفاده | برمی گرداند | Number. hypot (right) | شماره |
استدلال | تایپ کنید | جزئیات | این: left | شماره | مقدار سمت چپ. |
right | شماره | مقدار سمت راست. |
نمونه ها
ویرایشگر کد (جاوا اسکریپت)
// 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
راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap
برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap
کولب (پایتون)
# 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())
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\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```"]]