示例#1
0
 internal BasicGraphPath(BasicGraph graph, List <Vec3d> list, int type)
 {
     this.list = new List <BasicGraphNode>(list.Count);
     foreach (Vec3d v in list)
     {
         BasicGraphNode bn = graph.GetNode(v);
         this.list.Add(bn);
         bn.partOfPath.Add(this);
     }
     this.type = type;
 }
示例#2
0
        internal BasicGraphNode GetNode(Vec3d v)
        {
            foreach (BasicGraphNode n in nodes)
            {
                if (Math.Abs(n.position.X - v.X) < 0.1f &&
                    Math.Abs(n.position.Y - v.Y) < 0.1f &&
                    Math.Abs(n.position.Z - v.Z) < 0.1f)
                {
                    return(n);
                }
            }
            BasicGraphNode newNode = new BasicGraphNode(v);

            nodes.Add(newNode);
            return(newNode);
        }