The crux of this particular problem is to find the number of paths between sub points (after sorting based on their respective positions) and then multiplying all the number of paths.
The solution here would be:
1. Sort the points from Source to Destination.
Example:
If start point is [0,0] end point is [10,10] and intermediate points being [5,6],[2,4] & [8,8], then the sorted points (including source and destination) would be [0,0], [2,4], [5,6], [8,8], [10,10] in a 11X11 matrix
2. Find the number of Paths (preferably using DP) from source to next sub-destination. (In order of sorted points)
In the above example, the number of paths that need to be calculated would be between the following points:
[0,0] to [2,4]
[2,4] to [5,6]
[5,6] to [8,8]
[8,8] to [10,10]
3. Find the product of all the above 4 sub paths
That's it
Here's a solution for finding number of paths (see DP approach) from a source and destination. You need not pass the matrix as argument as that is just not needed. Only source and destination points are needed in the form of [x,y] [X,Y]. The other part (sorting the points and multiplying) has to be done as explained above apart from the code present in the link.