Calculating cost distance is somewhat involved. Take as an example a cell, size 10, that costs $1.15 per unit distance to cross. What is the cost of traveling from the center of such a cell directly to its southern edge? See Figure 8-18. The length of this segment is 5 (half the total distance of 10 across the cell). The cost associated with the cell is 1.15 per unit of distance. The cost of this segment, then, is the product of the distance and the cost per unit distance: 5 * 1.15 = 5.75.

When the path goes from cell corner to corner, the distance is longer than if the path goes from the side of a cell to the opposite side. How much longer? Multiply the side-to-side distance by the square root of 2, which is approximately 1.41421356237, which we will round to 1.414. See Figure 8-19.

For example, the cost to go diagonally across a 10 unit cell that had a toll of $1.15 would be

10 * 1.414 * 1.15 = 16.261

Each possible path from the source cell to each other cell is either calculated or considered in some way. That can be a lot of paths. This type of calculation may take place several times for each ...

Start Free Trial

No credit card required