public void Init(TilePropagator propagator) { if (pathViewIsFresh) { pathViewIsFresh = false; } else { pathView = PathSpec.MakeView(propagator); } pathView.Init(); }
internal IPickHeuristic GetHeuristic( IRandomPicker randomPicker, Func <double> randomDouble, TilePropagator propagator, TileModelMapping tileModelMapping, IPickHeuristic fallbackHeuristic) { pathView = PathSpec.MakeView(propagator); pathViewIsFresh = true; if (pathView is EdgedPathView epv) { return(new FollowPathHeuristic( randomPicker, randomDouble, propagator, tileModelMapping, fallbackHeuristic, epv)); } else { throw new NotImplementedException(); } }
public PathView(PathSpec spec, TilePropagator propagator) { if (spec.TileRotation != null) { tiles = new HashSet <Tile>(spec.TileRotation.RotateAll(spec.Tiles)); endPointTiles = spec.RelevantTiles == null ? null : new HashSet <Tile>(spec.TileRotation.RotateAll(spec.RelevantTiles)); } else { tiles = spec.Tiles; endPointTiles = spec.RelevantTiles; } tileSet = propagator.CreateTileSet(tiles); selectedTracker = propagator.CreateSelectedTracker(tileSet); Graph = PathConstraintUtils.CreateGraph(propagator.Topology); this.propagator = propagator; CouldBePath = new bool[propagator.Topology.IndexCount]; MustBePath = new bool[propagator.Topology.IndexCount]; hasEndPoints = spec.RelevantCells != null || spec.RelevantTiles != null; if (hasEndPoints) { CouldBeRelevant = new bool[propagator.Topology.IndexCount]; MustBeRelevant = new bool[propagator.Topology.IndexCount]; endPointIndices = spec.RelevantCells == null ? null : spec.RelevantCells.Select(p => propagator.Topology.GetIndex(p.X, p.Y, p.Z)).ToList(); endPointTileSet = spec.RelevantTiles != null?propagator.CreateTileSet(endPointTiles) : null; endPointSelectedTracker = spec.RelevantTiles != null?propagator.CreateSelectedTracker(endPointTileSet) : null; } else { CouldBeRelevant = CouldBePath; MustBeRelevant = MustBePath; endPointTileSet = tileSet; } }