RogueSharp
Show / Hide Table of Contents

Class PathFinder

A class which can be used to find shortest path from a source to a destination in a Map

Inheritance
System.Object
PathFinder
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: RogueSharp
Assembly: RogueSharp.dll
Syntax
public class PathFinder

Constructors

| Improve this Doc View Source

PathFinder(IMap)

Constructs a new PathFinder instance for the specified Map that will not consider diagonal movements to be valid.

Declaration
public PathFinder(IMap map)
Parameters
Type Name Description
IMap map

The Map that this PathFinder instance will run shortest path algorithms on

Exceptions
Type Condition
System.ArgumentNullException

Thrown when a null map parameter is passed in

| Improve this Doc View Source

PathFinder(IMap, Double)

Constructs a new PathFinder instance for the specified Map that will consider diagonal movement by using the specified diagonalCost

Declaration
public PathFinder(IMap map, double diagonalCost)
Parameters
Type Name Description
IMap map

The Map that this PathFinder instance will run shortest path algorithms on

System.Double diagonalCost

The cost of diagonal movement compared to horizontal or vertical movement. Use 1.0 if you want the same cost for all movements. On a standard cartesian map, it should be sqrt(2) (1.41)

Exceptions
Type Condition
System.ArgumentNullException

Thrown when a null map parameter is passed in

Methods

| Improve this Doc View Source

ShortestPath(ICell, ICell)

Returns a shortest Path containing a list of Cells from a specified source Cell to a destination Cell

Declaration
public Path ShortestPath(ICell source, ICell destination)
Parameters
Type Name Description
ICell source

The Cell which is at the start of the path

ICell destination

The Cell which is at the end of the path

Returns
Type Description
Path

Returns a shortest Path containing a list of Cells from a specified source Cell to a destination Cell

Exceptions
Type Condition
System.ArgumentNullException

Thrown when source or destination is null

PathNotFoundException

Thrown when there is not a path from the source to the destination

| Improve this Doc View Source

TryFindShortestPath(ICell, ICell)

Returns a shortest Path containing a list of Cells from a specified source Cell to a destination Cell

Declaration
public Path TryFindShortestPath(ICell source, ICell destination)
Parameters
Type Name Description
ICell source

The Cell which is at the start of the path

ICell destination

The Cell which is at the end of the path

Returns
Type Description
Path

Returns a shortest Path containing a list of Cells from a specified source Cell to a destination Cell. If no path is found null will be returned

Exceptions
Type Condition
System.ArgumentNullException

Thrown when source or destination is null

  • Improve this Doc
  • View Source
RogueSharp © 2014-2020 Faron Bracy
Back to top