A Comprehensive PathFinding Library for Objective-C.
Based on PathFinding.js by @qiao.
可用于iOS与OSX。
安装
pod 'PathFindingForObjC'
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];
2
txx 2015-05-12 16:59:14 +08:00
要是我,我会选择用 JSCore 包一层直接用= =
|
4
zerh925 2015-05-14 11:37:51 +08:00
好顶赞
之前解决TSP问题弄过遗传,蚁群算法。 为了找两张图像的histogram的correlation matrix研究过Dijkstra。 不知道楼主这个的速度怎么样? |