PolygonPathFinder
Тип C# SDK Reckfell.
Объявления сверены с C# SDK 1.0.0. Раскройте имя, чтобы увидеть сигнатуры и описание.
Конструкторы1
PolygonPathFinderКонструктор
public PolygonPathFinder();Свойства1
DataСвойство
public Reckfell.Collections.Dictionary Data { get; set; }Методы9
FindPathVector2[]
public Vector2[] FindPath(Vector2 from, Vector2 to);| Имя | Тип | По умолчанию |
|---|---|---|
from | Vector2 | — |
to | Vector2 | — |
Возвращает
Vector2[]GetBoundsRect2
public Rect2 GetBounds();Возвращает
Rect2GetClosestPointVector2
public Vector2 GetClosestPoint(Vector2 point);| Имя | Тип | По умолчанию |
|---|---|---|
point | Vector2 | — |
Возвращает
Vector2GetIntersectionsVector2[]
public Vector2[] GetIntersections(Vector2 from, Vector2 to);| Имя | Тип | По умолчанию |
|---|---|---|
from | Vector2 | — |
to | Vector2 | — |
Возвращает
Vector2[]GetPointPenaltyfloat
public float GetPointPenalty(int idx);| Имя | Тип | По умолчанию |
|---|---|---|
idx | int | — |
Возвращает
floatIsPointInsidebool
public bool IsPointInside(Vector2 point);Возвращает true, если point попадает внутрь области многоугольника.
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
new Vector2(0.0f, 0.0f),
new Vector2(1.0f, 0.0f),
new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);
ReckfellApi.Print(polygonPathFinder.IsPointInside(new Vector2(0.2f, 0.2f))); // Prints True
ReckfellApi.Print(polygonPathFinder.IsPointInside(new Vector2(1.0f, 1.0f))); // Prints False| Имя | Тип | По умолчанию |
|---|---|---|
point | Vector2 | — |
Возвращает
boolSetPointPenaltyvoid
public void SetPointPenalty(int idx, float penalty);| Имя | Тип | По умолчанию |
|---|---|---|
idx | int | — |
penalty | float | — |
Setup2 перегрузки
public void Setup(Vector2[] points, int[] connections);Устанавливает PolygonPathFinder с массивом точек, которые определяют вершины многоугольника, и массивом индексов, которые определяют ребра многоугольника.
Длина connections должна быть четной, возвращает ошибку, если нечетная.
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
new Vector2(0.0f, 0.0f),
new Vector2(1.0f, 0.0f),
new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);| Имя | Тип | По умолчанию |
|---|---|---|
points | Vector2[] | — |
connections | int[] | — |
public void Setup(ReadOnlySpan<Vector2> points, ReadOnlySpan<int> connections);Устанавливает PolygonPathFinder с массивом точек, которые определяют вершины многоугольника, и массивом индексов, которые определяют ребра многоугольника.
Длина connections должна быть четной, возвращает ошибку, если нечетная.
var polygonPathFinder = new PolygonPathFinder();
Vector2[] points =
[
new Vector2(0.0f, 0.0f),
new Vector2(1.0f, 0.0f),
new Vector2(0.0f, 1.0f)
];
int[] connections = [0, 1, 1, 2, 2, 0];
polygonPathFinder.Setup(points, connections);| Имя | Тип | По умолчанию |
|---|---|---|
points | ReadOnlySpan<Vector2> | — |
connections | ReadOnlySpan<int> | — |
Документация Reckfell EngineНаверх ↑