Esempio n. 1
0
        /// <summary>
        /// Creates connection between two points
        /// </summary>
        /// <param name="from">The point, where the connections starts</param>
        /// <param name="to">The point, where the connection ends</param>
        void ConnectPoints(CandidatePoint from, CandidatePoint to)
        {
            CandidatesConnection c = new CandidatesConnection()
            {
                From = from, To = to
            };

            from.OutgoingConnections.Add(c);
            to.IncomingConnections.Add(c);
        }
Esempio n. 2
0
        /// <summary>
        /// Calculates transmission probability for connection
        /// </summary>
        /// <param name="c">Connection</param>
        /// <returns>double value representing transmission probability</returns>
        double CalculateTransmissionProbability(CandidatesConnection c)
        {
            double gcd          = Calculations.GetDistance2D(c.From.MapPoint, c.To.MapPoint);
            double shortestPath = FindShortestPath(c.From, c.To);

            if (gcd == 0 && shortestPath == 0)
            {
                return(1);
            }
            else
            {
                return(gcd / shortestPath);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Calculates transmission probability for connection
        /// </summary>
        /// <param name="c">Connection</param>
        /// <returns>double value representing transmission probability</returns>
        double CalculateTransmissionProbability(CandidatesConnection c)
        {
            double gcd = Calculations.GetDistance2D(c.From.MapPoint, c.To.MapPoint);
            double shortestPath = FindShortestPath(c.From, c.To);

            if (gcd == 0 && shortestPath == 0)
                return 1;
            else
                return gcd / shortestPath;
        }
 /// <summary>
 /// Creates connection between two points
 /// </summary>
 /// <param name="from">The point, where the connections starts</param>
 /// <param name="to">The point, where the connection ends</param>
 void ConnectPoints(CandidatePoint from, CandidatePoint to)
 {
     CandidatesConnection c = new CandidatesConnection() { From = from, To = to };
     from.OutgoingConnections.Add(c);
     to.IncomingConnections.Add(c);
 }