Beispiel #1
0
        /// <summary>
        /// Adds a bi-directional edge to this node, weighted evenly.
        /// </summary>
        /// <param name="other">The other node to share the edge with.</param>
        /// <param name="weight">The weight for the edge, default value is 1.</param>
        public void addBidirEdge(Node other, float weight = 1)
        {
            //helps w/diagonal movement.
            //float avgPen = (other.edgePenalty + this.edgePenalty) / 2.0f;
            //this.addEdge(new Edge(other, weight * avgPen));
            //other.addEdge(new Edge(this, weight * avgPen));

            this.addEdge(new Edge(other, weight * other.edgePenalty));
            other.addEdge(new Edge(this, weight * this.edgePenalty));
        }