Processing:Справочник языка Processing/PVector/dist(): различия между версиями
Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску
Myagkij (обсуждение | вклад) |
Нет описания правки |
||
Строка 2: | Строка 2: | ||
{{Myagkij-редактор}} | {{Myagkij-редактор}} | ||
= dist() <ref>[https://processing.org/reference/PVector_dist_.html processing.org - dist()]</ref>= | = dist() <ref>[https://processing.org/reference/PVector_dist_.html processing.org - dist()]</ref>= | ||
Строка 8: | Строка 8: | ||
==Обозначение== | ==Обозначение== | ||
<syntaxhighlight lang="c | <syntaxhighlight lang="c"> | ||
dist() | dist() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Строка 18: | Строка 18: | ||
==Синтаксис== | ==Синтаксис== | ||
<syntaxhighlight lang="c | <syntaxhighlight lang="c"> | ||
.dist(v) | .dist(v) | ||
.dist(v1, v2) | .dist(v1, v2) | ||
Строка 25: | Строка 25: | ||
==Параметры== | ==Параметры== | ||
<syntaxhighlight lang="c | <syntaxhighlight lang="c"> | ||
v - тип PVector: координаты x, y и z PVector | v - тип PVector: координаты x, y и z PVector | ||
v1 - тип PVector: любая переменная типа PVector | v1 - тип PVector: любая переменная типа PVector | ||
Строка 33: | Строка 33: | ||
==Возвращаемое значение== | ==Возвращаемое значение== | ||
<syntaxhighlight lang="c | <syntaxhighlight lang="c"> | ||
float | float | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Строка 41: | Строка 41: | ||
===№1=== | ===№1=== | ||
<syntaxhighlight lang="c" line="GESHI_NORMAL_LINE_NUMBERS|GESHI_FANCY_LINE_NUMBERS | <syntaxhighlight lang="c" line="GESHI_NORMAL_LINE_NUMBERS|GESHI_FANCY_LINE_NUMBERS"> | ||
PVector v1 = new PVector(10, 20, 0); | PVector v1 = new PVector(10, 20, 0); | ||
PVector v2 = new PVector(60, 80, 0); | PVector v2 = new PVector(60, 80, 0); | ||
Строка 50: | Строка 50: | ||
===№2=== | ===№2=== | ||
<syntaxhighlight lang="c" line="GESHI_NORMAL_LINE_NUMBERS|GESHI_FANCY_LINE_NUMBERS | <syntaxhighlight lang="c" line="GESHI_NORMAL_LINE_NUMBERS|GESHI_FANCY_LINE_NUMBERS"> | ||
PVector v1 = new PVector(10, 20, 0); | PVector v1 = new PVector(10, 20, 0); | ||
PVector v2 = new PVector(60, 80, 0); | PVector v2 = new PVector(60, 80, 0); | ||
Строка 78: | Строка 78: | ||
|Высота логотипа издателя для schemaNewsArticle=45 | |Высота логотипа издателя для schemaNewsArticle=45 | ||
}} | }} | ||
{{Навигационная таблица/ | {{Навигационная таблица/Портал/Processing}} |
Версия от 12:05, 20 мая 2023
Содержание | Среда разработки Processing | Справочник языка Processing | Библиотеки | Примеры | Режимы программирования |
Проверка/Оформление/Редактирование: Мякишев Е.А.
dist() [1]
Обозначение
dist()
Описание
Вычисляет Евклидово расстояние между двумя точками (учитывая точку как векторный объект).
Синтаксис
.dist(v)
.dist(v1, v2)
Параметры
v - тип PVector: координаты x, y и z PVector
v1 - тип PVector: любая переменная типа PVector
v2 - тип PVector: любая переменная типа PVector
Возвращаемое значение
float
Пример
№1
PVector v1 = new PVector(10, 20, 0);
PVector v2 = new PVector(60, 80, 0);
float d = v1.dist(v2);
println(d); // печатаем в консоли "78.10249"
№2
PVector v1 = new PVector(10, 20, 0);
PVector v2 = new PVector(60, 80, 0);
float d = PVector.dist(v1, v2);
println(d); // печатаем в консоли "78.10249"
См.также
Внешние ссылки
Примеры на Processing | |
---|---|
Основы |
|
Продвинутые графические эффекты |
|
Примеры из сторонних библиотек |