Beispiel #1
0
 public Graph GetGraph()
 {
     if (lay.CurrentStateBuffer != null)
     {
         Particle3d[] particleArray = new Particle3d[lay.ParticleCount];
         lay.CurrentStateBuffer.GetData(particleArray);
         Graph graph = new Graph();
         foreach (var p in particleArray)
         {
             graph.AddNode(new SpatialNode(p.Position, p.Size, new Color(p.Color)));
         }
         foreach (var l in edgeList)
         {
             graph.AddEdge(new Graph.Edge((int)l.par1, (int)l.par2, l.length, l.strength));
         }
         return graph;
     }
     return new Graph();
 }
Beispiel #2
0
        public static Graph MakeString(int nodeCount)
        {
            Graph graph = new Graph();

            graph.AddNode(new BaseNode());
            for (int i = 1; i < nodeCount; ++i)
            {
                graph.AddNode(new BaseNode());
                graph.AddEdge(graph.NodeCount - 2, graph.NodeCount - 1);
            }
            return graph;
        }