private void GetGraphPath(PathRegion pathRegion, int pEnd, int pStart) { List <Point3D> testFirstManipulator = new List <Point3D>(); int countGraphVerticesBeforeAdding = _graphVertices.Count; rbLog.AppendText("Добавляем вершины в граф..\n"); rbLog.ScrollToCaret(); rbLog.Refresh(); for (int i = 0; i < _iterations; i++) { Point3D currentPoint = new Point3D(TrueRandom.GetRandomInt(pathRegion.minX, pathRegion.maxX), TrueRandom.GetRandomInt(pathRegion.minY, pathRegion.maxY), TrueRandom.GetRandomInt(pathRegion.minZ, pathRegion.maxZ)); testFirstManipulator.Add(currentPoint); _graphVertices.Add(new GraphVertex(countGraphVerticesBeforeAdding + i, currentPoint, true)); } rbLog.AppendText("Удаление некорректных вершин..\n"); rbLog.ScrollToCaret(); rbLog.Refresh(); rbLog.AppendText("Расширяем матрицу весов..\n"); rbLog.ScrollToCaret(); rbLog.Refresh(); IsCorrectVertex(ref _graphVertices, _safeDistance, pEnd, pStart); _adjencyMatrixManipulator = ResizeAdjencyMatrixManipulator(_adjencyMatrixManipulator, _graphVertices.Count - _adjencyMatrixManipulator.GetLength(0)); int countLastAdjencyMatrix = _adjencyMatrixManipulator.GetLength(0); for (int i = countGraphVerticesBeforeAdding; i < _adjencyMatrixManipulator.GetLength(0); i++) { _graphVertices[i].Number = i; } rbLog.AppendText("Соединяем новые вершины..\n"); rbLog.ScrollToCaret(); rbLog.Refresh(); TryToConnect(_graphVertices, _distanceBetweenPoints, _adjencyMatrixManipulator, AlgoritmTryType.CleanDataWork); }
private void GetGraphPath(int pEnd, int pStart, PathRegion pathRegion) { List <Point3D> testFirstManipulator = new List <Point3D>(); rbLog.AppendText("Добавляем вершины..\n"); rbLog.ScrollToCaret(); rbLog.Refresh(); for (int i = 0; i < _iterations; i++) { Point3D currentPoint = new Point3D(TrueRandom.GetRandomInt(pathRegion.minX, pathRegion.maxX), TrueRandom.GetRandomInt(pathRegion.minY, pathRegion.maxY), TrueRandom.GetRandomInt(pathRegion.minZ, pathRegion.maxZ)); testFirstManipulator.Add(currentPoint); _graphVertices.Add(new GraphVertex(i, currentPoint, true)); } rbLog.AppendText("Удаление некорректных вершин..\n"); rbLog.ScrollToCaret(); rbLog.Refresh(); IsCorrectVertex(ref _graphVertices, _safeDistance, pEnd, pStart); _adjencyMatrixManipulator = new int[_graphVertices.Count, _graphVertices.Count]; for (int i = 0; i < _graphVertices.Count; i++) { _graphVertices[i].Number = i; } rbLog.AppendText("Составление матрицы смежности..\n"); rbLog.ScrollToCaret(); rbLog.Refresh(); TryToConnect(_graphVertices, _distanceBetweenPoints, _adjencyMatrixManipulator, AlgoritmTryType.CleanDataWork); }