Relax the Point

Land Desktop Map 3D Samples

 
Relax the Point
 
 
 

This method takes the following five arguments:

  • a candidate point
  • a point connected to the candidate point by a link
  • the ready list
  • the not ready list
  • the distance bewteen the second point argument and its previous point

This block does the following:

  1. Determines that the candidate point is in the ready list and returns.
    NoteThe second point argument for the four calls to this block has coordinates (1905922, 472443). In the first call (1905112, 472448) is not in the ready list. In the second call (1906072, 472441) is not in the ready list. In the third call (1905927, 472596) is in the ready list and the method returns. In the fourth call (1905929, 472103) is not in the ready list.
    NoteThe second point argument for the fifth call to this block has coordinates (1906072, 472441). In the first and only call (1905922, 472443) is in the ready list and the method returns.
  2. Determines that the candidate point is in the not ready list and replaces the candidate point with the point that is in the not ready list.
    NoteIn the first call (1905112, 472448) is not in the not ready list.
    NoteIn the second call (1906072, 472441) is not in the not ready list.
    NoteIn the fourth call (1905929, 472103) is not in the not ready list.
  3. Calculates the length of the link whose boundary points are the two point arguments.
    NoteIn the first call the distance between (1905112, 472448) and (1905922, 472443) is 814.
    NoteIn the second call the distance between (1906072, 472441) and (1905922, 472443) is 152.
    NoteIn the second call the distance between (1905929, 472103) and (1905922, 472443) is 347.
  4. Queries the candidate point for the distance between it and its previous point.
    NoteIn the first call the distance between (1905112, 472448) and its previous point is 2147483647 because it has no previous point.
    NoteIn the second call the distance between (1906072, 472441) and its previous point is 2147483647 because it has no previous point.
    NoteIn the fourth call the distance between (1905929, 472103) and its previous point is 2147483647 because it has no previous point.
  5. Determines that the distance between the candidate point and its prevous point is greater than the sum of the distances between the two point arguments and the second point argument and its previous point and sets the candidate point’s prevous point to be the second point argument and the candidate point’s current distance to be the sum of the distances between the two point arguments and the second point argument and its previous point.
    NoteIn the first call the candidate point is (1905112, 472448) and its previous point becomes (1905922, 472443); this is link ‘D’ in the graphic. The current distance property of the candidate point becomes (814 + 156), which is the length of link ‘D’ + the length of link ‘A’. This is because the previous point of point (1905922, 472443) is the start point ((1905927, 472596).
    NoteIn the second call the candidate point is (1906072, 472441) and its previous point becomes (1905922, 472443); this is link ‘E’ in the graphic. The current distance property of the candidate point becomes (152 + 156), which is the length of link ‘E’ + the length of link ‘A’. This is because the previous point of point (1905922, 472443) is the start point (1905927, 472596).
    NoteIn the fourth call the candidate point is (1905929, 472103) and its previous point becomes (1905922, 472443); this is link ‘F’ in the graphic. The current distance property of the candidate point becomes (347 + 156), which is the length of link ‘F’ + the length of link ‘A’. This is because the previous point of point (1905922, 472443) is the start point (1905927, 472596).
  6. Remembers that the candidate point is not in the not ready list, calculates an index for it, adds it to the not ready list, and sorts the list in ascending order according to the point’s current distance property.
    NoteThe index calculated for the point is not an index into the not ready list. It is a value stored in the point data structure.
    NoteIn the first call the candidate point gets an index of 1, and it is the only point in the not ready list.
    NoteIn the second call the candidate point gets an index of 2, and it is one of two points in the not ready list. As a result of the sort the point (1906072, 472411) is before the point (1905112, 472448) in the not ready list since its total distance from the start point (307) is less than that of point (1905112, 472448) (970).
    NoteIn the fourth call the candidate point gets an index of 3, and it is one of three points in the not ready list. As a result of the sort the order is (1906072, 472411), (1905929, 472103), and (1905112, 472448).