Click or drag to resize

Algorithms Class

This class provide generic functions for common grid operations, such as finding a shortest path or connected shapes.
Inheritance Hierarchy
SystemObject
  Gamelogic.GridsAlgorithms

Namespace:  Gamelogic.Grids
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
[VersionAttribute(1, 0, 0)]
public static class Algorithms

The Algorithms type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAggregateNeighborhoodTCell, TPoint(IGridTCell, TPoint, FuncTPoint, IEnumerableTPoint, TCell)
Public methodStatic memberAggregateNeighborhoodTCell, TPoint, TResultGrid, TResultCell(IGridTCell, TPoint, FuncTPoint, IEnumerableTPoint, TResultCell)
Public methodStatic memberAStarTCell, TPoint(IGridTCell, TPoint, TPoint, TPoint)
Find the shortest path between a start and goal node. The distance between nodes(as defined by TPoint.DistanceFrom) are used as the heuristic and actual cost between nodes.In some cases the result may be unintuitive, and an overload specifying a different cost should be used. See AStar<TCell, TPoint>(IGrid<TCell, TPoint>, TPoint, TPoint, Func<TPoint, TPoint, float>, Func<TCell, bool>, Func<TPoint, TPoint, float>)
Public methodStatic memberAStarTCell, TPoint(IGridTCell, TPoint, TPoint, TPoint, FuncTPoint, TPoint, Single, FuncTCell, Boolean) Obsolete.
Find the shortest path between a start and goal node. The distance between nodes(as defined by TPoint.DistanceFrom) are used as the actual cost between nodes.In some cases the result may be unintuitive, and an overload specifying a different cost should be used. Using an overload with an appropriate distance function can solve the issue. See AStar<TCell, TPoint>(IGrid<TCell, TPoint>, TPoint, TPoint, Func<TPoint, TPoint, float>, Func<TCell, bool>, Func<TPoint, TPoint, float>)
Public methodStatic memberAStarTCell, TPoint(IGridTCell, TPoint, TPoint, TPoint, FuncTPoint, TPoint, Single, FuncTCell, Boolean, FuncTPoint, TPoint, Single)
Public methodStatic memberAStar2TCell, TPoint
Public methodStatic memberContainsTPoint
Public methodStatic memberGetBiggestShapeTPoint
Gets the biggest shape (by number of points) in the given list.
Public methodStatic memberGetConnectedLinesTCell, TPoint, TBasePoint
Public methodStatic memberCode exampleGetConnectedRaysTCell, TPoint
Returns a list containing lines connected to the given points. A line is a list of points. Only returns correct results for square or hex grids.
Public methodStatic memberGetConnectedSetTCell, TPoint
Public methodStatic memberGetLongestConnectedTCell, TPoint, TBasePoint Obsolete.
Public methodStatic memberGetLongestConnectedLineTCell, TPoint, TBasePoint
Get the longest line of points connected to the given point
Public methodStatic memberGetLongestConnectedRayTCell, TPoint
Public methodStatic memberGetPointsInRangeTCell, TPoint(IGridTCell, TPoint, TPoint, FuncTCell, Boolean, FuncTPoint, TPoint, Int32, Int32)
Public methodStatic memberCode exampleGetPointsInRangeTCell, TPoint(IGridTCell, TPoint, TPoint, FuncTCell, Boolean, FuncTPoint, TPoint, Single, Single)
A generic function that returns the points in range based on a given start point, moveRange, and a function that returns the cost of moving between neighboring cells. author Justin Kivak
Public methodStatic memberGetPointsInRangeCostTCell, TPoint(IGridTCell, TPoint, TPoint, FuncTCell, Boolean, FuncTPoint, TPoint, Int32, Int32)
Public methodStatic memberCode exampleGetPointsInRangeCostTCell, TPoint(IGridTCell, TPoint, TPoint, FuncTCell, Boolean, FuncTPoint, TPoint, Single, Single)
A generic function that returns the points in range based on a given start point, moveRange, and a function that returns the cost of moving between neighboring cells. author Justin Kivak
Public methodStatic memberCode exampleIsConnectedTCell, TPoint(IGridTCell, TPoint, IEnumerableTPoint, FuncTPoint, TPoint, Boolean)
The set is connected if the set of points are neighbor-connected, and isNeighborsConnected return true for each two neighbors in the set.Two points are connected if they are neighbors, or one point has a neighbor that is neighbor-connected with the other point.
Public methodStatic memberCode exampleIsConnectedTCell, TPoint(IGridTCell, TPoint, TPoint, TPoint, FuncTPoint, TPoint, Boolean)
The set is connected if the set of points are neighbor-connected, and isNeighborsConnected return true for each two neighbors in the set.Two points are connected if they are neighbors, or one point has a neighbor that is neighbor-connected with the other point. Another way to put this is, this function returns true if there is a set that connects point1 to point2.
Public methodStatic memberIsEquivalentTPoint
Public methodStatic memberIsEquivalentUnderTransformsAndTranslationTPoint
Public methodStatic memberIsEquivalentUnderTranslationTPoint
Public methodStatic memberRotate120About(IEnumerableFlatHexPoint, FlatHexPoint, FlatHexPoint, FlatHexPoint)
Rotates a shape 120 degrees around the vertice shared by the three given points. The three points must form a close triangle (they must share a vertex).
Public methodStatic memberRotate120About(IEnumerablePointyHexPoint, PointyHexPoint, PointyHexPoint, PointyHexPoint)
Rotates a shape 120 degrees around the vertice shared by the three given points. The three points must form a close triangle (they must share a vertex).
Public methodStatic memberRotate180About(IEnumerableFlatHexPoint, FlatHexPoint, FlatHexPoint)
Rotates a shape 180 degrees around the edge shared by the two given points. The two points must be neighbors.
Public methodStatic memberRotate180About(IEnumerablePointyHexPoint, PointyHexPoint, PointyHexPoint)
Rotates a shape 180 degrees around the edge shared by the two given points. The two points must be neighbors.
Public methodStatic memberRotate240About(IEnumerableFlatHexPoint, FlatHexPoint, FlatHexPoint, FlatHexPoint)
Rotates a shape 240 degrees around the vertice shared by the three given points. The three points must form a close triangle (they must share a vertex).
Public methodStatic memberRotate240About(IEnumerablePointyHexPoint, PointyHexPoint, PointyHexPoint, PointyHexPoint)
Rotates a shape 240 degrees around the vertice shared by the three given points. The three points must form a close triangle (they must share a vertex).
Public methodStatic memberTransformShapeTPoint
Transform each point in the list with the give point transformation.
Top
See Also