private void GetObstaclesPerLayer(int currentLayer, ObstacleCollection obstacles) { var rawObstacles = GetBlockObstacles(currentLayer); var nodes = new LineNodeDictionary(); nodes.CreateLineNodes(rawObstacles); while (nodes.Count > 0) { var currentFigure = new RawFigure(_map, currentLayer, nodes); nodes.Purge(currentFigure.Lines); currentFigure.Optimize(); currentFigure.Tokenize(obstacles); } nodes.Clear(); nodes.CreateLineNodes(rawObstacles, true); while (nodes.Count > 0) { var currentFigure = new SlopeFigure(_map, currentLayer, nodes); nodes.Purge(currentFigure.Lines); currentFigure.Optimize(); currentFigure.Tokenize(obstacles); } }