C#C
C#2y ago
Cam

✅ 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 Cration 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));
                }
            }
        }
    }
image.png
Was this page helpful?