Esempio n. 1
0
        /// <summary>
        /// Calculates the weight and direction for the given edge profile.
        /// </summary>
        public sealed override WeightAndDir <float> CalculateWeightAndDir(ushort edgeProfile, float distance, out bool accessible)
        {
            var factor = _getFactor(edgeProfile);
            var weight = new WeightAndDir <float>();

            if (factor.Direction == 0)
            {
                weight.Direction = new Dir(true, true);
            }
            else if (factor.Direction == 1)
            {
                weight.Direction = new Dir(true, false);
            }
            else
            {
                weight.Direction = new Dir(false, true);
            }

            weight.Weight = distance * factor.Value;
            accessible    = factor.Value != 0;
            return(weight);
        }
Esempio n. 2
0
 /// <summary>
 /// Adds a new vertex to the given path tree with the given weight and pointer.
 /// </summary>
 public uint AddPathTree(PathTree tree, uint vertex, WeightAndDir <T> weight, uint previous)
 {
     return(this.AddPathTree(tree, vertex, weight.Weight, previous));
 }