Exemple #1
0
        private int GetPathLength(AbstractNode startNode, AbstractNode goalNode)
        {
            clusterMap.Start = startNode.LocationL1;
            clusterMap.Goal  = goalNode.LocationL1;

            int count;

            //Call A*
            List <PathFinderNode> intraPath = FGAlgorythm.GetPathByMap(clusterMap);

            if (intraPath == null)
            {
                return(0);
            }
            else
            {
                count = intraPath.Count - 1;

                //write path to AbstractGraph
                List <AbstractNode> path = new List <AbstractNode>();
                foreach (PathFinderNode item in intraPath)
                {
                    Location     location     = new Location(item.X, item.Y, item.Z);
                    AbstractNode abstractNode = new AbstractNode()
                    {
                        LocationL0 = LocationConvertor.L1ToL0(location, _cluster)
                    };

                    path.Add(abstractNode);
                }
                AbstractGraph.IntraPathes[startNode.Id, goalNode.Id] = path;
            }

            return(count);
        }
        private void SetValues(Cluster cluster, Location L1)
        {
            Location L0 = LocationConvertor.L1ToL0(L1, cluster);

            WriteNodeToCluster(cluster, L0, L1);

            //Mark nodes for MapMatrixL1 visualization
            AbstractGraph.MapMatrixL1[L0.X, L0.Y, L0.Z] = 5;

            //Mark nodes for ClusterMatrix visualization
            cluster.Matrix[L1.X, L1.Y, L1.Z] = 5;
        }
Exemple #3
0
        void AddToCluster(Location L0)
        {
            cluster = Node.GetCluster(L0);
            Location L1 = LocationConvertor.L0ToL1(L0, cluster);

            node = new AbstractNode()
            {
                Id         = AbstractGraph.NodesCount + 1,
                LocationL0 = L0,
                LocationL1 = L1
            };
            AbstractGraph.NodesCount += 1;
            cluster.AbstractNodes.Add(node);
        }