Click here to Skip to main content
15,886,873 members
Articles / Programming Languages / C# 4.0

A Complex - Yet Quite Intelligible - Pathfinding in C#

Rate me:
Please Sign up or sign in to vote.
4.96/5 (41 votes)
30 Aug 2013CPOL21 min read 59.5K   2.5K   88  
A semi-analytic 2D path-finding for large dynamic scenarios.
using System;
using System.Collections.Generic;
using System.Drawing;
using YinYang.CodeProject.Projects.SimplePathfinding.Helpers;

namespace YinYang.CodeProject.Projects.SimplePathfinding.PathFinders
{
    public interface IPathfinder
    {
        /// <summary>
        /// Performs the search for a path from <see cref="startPoint" /> to <see cref="endPoint" />.
        /// Returning status whether the <see cref="endPoint" /> is accessible or not, and it is,
        /// also returns the list of the points leading to a <see cref="endPoint" />.
        /// </summary>
        /// <param name="startPoint">The starting point.</param>
        /// <param name="endPoint">The end position to be reached by a (to be found) path.</param>
        /// <param name="stopFunction">The stop function.</param>
        /// <param name="path">Returns the list of all the points of found path.</param>
        /// <param name="pivotPoints">Returns the list of the pivot points (sector points and corners).</param>
        /// <param name="optimize">Determines whether the optimization is turned on.</param>
        /// <returns>
        /// If set to <c>True</c> the path was found, otherwise the target point is inaccessible.
        /// </returns>
        Boolean TryFindPath(Point startPoint, Point endPoint,
                            StopFunction stopFunction, 
                            out IReadOnlyCollection<Point> path, 
                            out IReadOnlyCollection<Point> pivotPoints,
                            Boolean optimize = true);
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Czech Republic Czech Republic
Contacts: EMAIL - smartk8@gmail.com

Comments and Discussions