Example #1
0
        public void LoadOutputFileSides(string path)
        {
            _visGraph.ClearEdges();

            FileStream fileStream = new FileStream(path, FileMode.Open);

            using (var file = new StreamReader(fileStream))
            {
                var line = file.ReadLine();
                if (line == null)
                {
                    throw new Exception("unexpected end of file");
                }
                line = line.TrimStart(' ');

                int numTriangles = Int32.Parse(line.Split(' ').First());

                for (int i = 0; i < numTriangles; i++)
                {
                    line = file.ReadLine();
                    if (line == null)
                    {
                        break;
                    }

                    line = line.TrimStart(' ');
                    var lineParsed = Regex.Split(line, @"\s{2,}");
                    int id0        = Int32.Parse(lineParsed[1]) - 1;
                    int id1        = Int32.Parse(lineParsed[2]) - 1;
                    int id2        = Int32.Parse(lineParsed[3]) - 1;

                    var v0 = _outPoints[id0];
                    var v1 = _outPoints[id1];
                    var v2 = _outPoints[id2];
                    AddVisEdge(v0, v1);
                    AddVisEdge(v1, v2);
                    AddVisEdge(v2, v0);
                }
            }
        }