PathFindingForObjC 1.0.0

PathFindingForObjC 1.0.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Apr 2015

Maintained by Jasio Woo.




  • By
  • Jasio Woo

A Comprehensive PathFinding Library for Objective-C.
Based on PathFinding.js by @qiao.

Installation

Manually

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop PathFindingForObjC/PathFindingForObjC into your project
  3. Add #import PathFinding.h to your source file.

Disable logging

Click on your Project Target, head over to Build Settings and search for Preprocessor Macros. add PF_DEBUG=0 to Debug Configuration.

Basic Usage

PathFinding *finder = [[PathFinding alloc] initWithMapSize:CGSizeMake(6, 5)
                                                  tileSize:CGSizeMake(1, 1)
                                               coordsOrgin:CGPointZero];
finder.heuristicType = HeuristicTypeManhattan;
finder.movementType = DiagonalMovement_Never;

// add blocks
[finder addBlockTilePositions:@[PF_CGPointToNSValue(CGPointMake(1, 2)),
                                PF_CGPointToNSValue(CGPointMake(2, 2)),
                                PF_CGPointToNSValue(CGPointMake(3, 2))
                                ]];
// set start point
finder.startPoint = CGPointMake(2, 3);
// set end point
finder.endPoint = CGPointMake(2, 1);
// get result
NSArray *foundPaths = [finder findPathing:PathfindingAlgorithm_AStar IsConvertToOriginCoords:YES];
debug log:

:mag: :mag: :mag: :mag: :mag: :mag:

:mag: :mag: :pray: :heartpulse: :heartpulse: :mag:

:mag: :underage: :underage: :underage: :heartpulse: :mag:

:mag: :mag: :no_good: :heartpulse: :heartpulse: :mag:

:mag: :mag: :mag: :mag: :mag: :mag:

Options

HeuristicType :

  • HeuristicTypeManhattan
  • HeuristicTypeEuclidean
  • HeuristicTypeOctile
  • HeuristicTypeChebyshev

DiagonalMovement :

  • DiagonalMovement_Always
  • DiagonalMovement_Never
  • DiagonalMovement_IfAtMostOneObstacle
  • DiagonalMovement_OnlyWhenNoObstacles

PathfindingAlgorithm :

  • PathfindingAlgorithm_AStar
  • PathfindingAlgorithm_BestFirstSearch
  • PathfindingAlgorithm_Dijkstra
  • PathfindingAlgorithm_JumpPointSearch
  • PathfindingAlgorithm_BreadthFirstSearch
  • PathfindingAlgorithm_BiAStar
  • PathfindingAlgorithm_BiBestFirst
  • PathfindingAlgorithm_BiDijkstra
  • PathfindingAlgorithm_BiBreadthFirst

DEMO

License

  • MIT