Aqua Phoenix
     >>  Research >>  Campus  
 

Navigator
   
 
       
    For a trinary spatial relationship, I have implemented inBetween. The function itself takes as arguments an (x, y) position, as well as 2 buildings. By itself, the function is not particularly useful, as it finds dozens of in-between relationships, even though they may exist in the opposite corner of the map.

The function is used in conjunction with a double loop that tries every pair of buildings, other than two of the same kind. For each such relationship, a few things are tested and kept track on, such as: buildingDistance, the actual distance between the centroids of the 2 buildings; clickDistance, the distance between the clicked position and the first building, plus the distance between the clicked position and the second building; and a test of whether the point happens to reside in one of the buildings. For the two mentioned distances, the goal is to minimize both as much as possible. As far as the In-tests are concerned, we do not wish to create an in-between relationship, if the point happens to be inside of a building. Similarly, we do not wish to create the relationship if the point happens to be in the perimeter of a building. It may not be terribly helpful to cite an in-between relationship when the visitor is in an L- or U-shaped building. In this instance it is better to cite the perimeter relationship instead.