C
C#10mo ago
Cam

✅ [AVALONIA] Return Coordinates (Only if a Polyline is present in those coordinates)

Ive completed my A* Pathfinding but need to dump alot of uneccesary coordinates from the created grid. Is there a way I can extract only the coordinates that are covered by Polyline Elements as shown below? Note: The Lines represent rails and the pathing algorithm should not be able to leave the dimensions of the rail Current Grid Coordinate Creation Code
c#
namespace Birds_Eye.Views.Resources.Functions
{
public class PanelGrid
{
private double width;
private double height;
private int[,] gridArray;
public Dictionary<panelTuple, PathNode> panelNodes = new Dictionary<panelTuple, PathNode>();
public PanelGrid(Canvas panelImport)
{
width = panelImport.Width;
height = panelImport.Height;
gridArray = new int[(int)width, (int)height];

for (int x = 0; x <= gridArray.GetLength(0); x++)
{
for (int y = 0; y <= gridArray.GetLength(1); y++)
{
panelNodes.Add(new panelTuple(x, y), new PathNode(x, y));
}
}
}
}
c#
namespace Birds_Eye.Views.Resources.Functions
{
public class PanelGrid
{
private double width;
private double height;
private int[,] gridArray;
public Dictionary<panelTuple, PathNode> panelNodes = new Dictionary<panelTuple, PathNode>();
public PanelGrid(Canvas panelImport)
{
width = panelImport.Width;
height = panelImport.Height;
gridArray = new int[(int)width, (int)height];

for (int x = 0; x <= gridArray.GetLength(0); x++)
{
for (int y = 0; y <= gridArray.GetLength(1); y++)
{
panelNodes.Add(new panelTuple(x, y), new PathNode(x, y));
}
}
}
}
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server