Ejemplo n.º 1
0
        void CreateTriangles(MapNode a, MapNode b, MapNode c)
        {
            _Triangles.Add(a._VertexIndex);
            _Triangles.Add(b._VertexIndex);
            _Triangles.Add(c._VertexIndex);

            MapTriangle triangle = new MapTriangle(a._VertexIndex, b._VertexIndex, c._VertexIndex);

            AddTriangleToDictionary(triangle.vertexIndexA, triangle);
            AddTriangleToDictionary(triangle.vertexIndexB, triangle);
            AddTriangleToDictionary(triangle.vertexIndexC, triangle);
        }
Ejemplo n.º 2
0
 void AddTriangleToDictionary(int vertexIndexKey, MapTriangle triangle)
 {
     if (_TriangleDictionary.ContainsKey(vertexIndexKey))
     {
         _TriangleDictionary[vertexIndexKey].Add(triangle);
     }
     else
     {
         List <MapTriangle> triangleList = new List <MapTriangle>();
         triangleList.Add(triangle);
         _TriangleDictionary.Add(vertexIndexKey, triangleList);
     }
 }
Ejemplo n.º 3
0
        private int GetConnectedOutlineVertext(int vertexIndex)
        {
            List <MapTriangle> triangelsContainingVertex = _TriangleDictionary[vertexIndex];

            for (int i = 0; i < triangelsContainingVertex.Count; i++)
            {
                MapTriangle triangle = triangelsContainingVertex[i];

                for (int j = 0; j < 3; j++)
                {
                    int vertexB = triangle[j];

                    if (vertexB != vertexIndex && !_CheckVertices.Contains(vertexB))
                    {
                        if (IsOutlineEdge(vertexIndex, vertexB))
                        {
                            return(vertexB);
                        }
                    }
                }
            }
            return(-1);
        }