Aqua Phoenix
     >>  Research >>  Campus  

Title: Campus
Course: W4735: Visual Interfaces, Prof. John R. Kender, Columbia University, New York, NY
Short Description: The goal of this assignment is to write a program that describes the location of a "visitor" to the "Columbia
Tools used: Java Swing
Platforms: Any Java compliant platform
Date: March, April 2001
    Quick Index  

    The goal of this assignment is to write a program that describes the location of a "visitor" to the "Columbia campus". More accurately, the program is to display a binary image of the main campus as seen from above, which then responds to any mouse click within it with an English description of where the visitor would be. For example, it could print out "Inside Low" or "Between Schapiro and Uris" or "South of Dodge and North of Journalism".

The main job is to encode the buildings' shapes, to determine their spatial relationships with the (x,y) coordinate of the mouse click, and to filter out any relationships that are unnecessary because they can be easily inferred. For example, if the visitor is "South of Uris", it is not necessary to also say "South of Schapiro", as this can be inferred from the relation that "Uris is South of Schapiro".

The following data files were created for the assignment: "campus.pgm", "labeled.pgm", "table.txt". The first file is a binary image of the main campus as seen from above, where ones represent the buildings and zeros represent the space between them. The second file is an integer-valued image based on the first, in which each building is given a code integer, and all the pixels belonging to the same building are encoded with the same integer; zero still means empty space. The third file is a text file which translates the code integer into a string, so that the answer can come out in English.

Firstly, print out, for each non-zero code integer that is clicked on, the following building shape features: the (x,y) of the center of mass, the area, and the upper left and lower right coordinates of its minimum bounding rectangle (MBR), and the English string of its name.

Design and code the boolean-valued functions for In(x,y,N), North(x,y,N), South(x,y,N), East(x,y,N), and West(x,y,N). Each function takes the coordinates of the mouse click (x,y), and the building code integer N, and returns true if the "visitor" is in the given relationship to the "building". Note that "In" is particularly simple, and that the other four are symmetric with respect to each other. But you have to decide how best to define those four without reference to any specific building, just to their generic shape features. It is probably more humanly accurate to have North be more complicated than simply "y > miny[N]". Now, for every mouse click, print out all spatial relationships that apply to (x,y), using the name of the relationship and English string of the building. This should generate on the order of about as many descriptions as there are buildings, depending on your definitions. Note that the order in which you produce the descriptions should not be arbitrary, but should be sorted in some intelligent way.

Now, represent all the possible spatial relationships of the mouse click to the buildings and the buildings to each other, and filter the relationships using their transitivity. For example, if the visitor is North of Low, and it is known from the map itself that Low is North of Butler, then it is not necessary to say that the visitor is North of Butler; this can be inferred. This filtering can be done by representing all the inter-building relationships as a graph or graphs even before the first mouse click, by then adding in the visitor relationships to these graphs once they become known, and then by detecting by the appropriate search algorithms those relationships that cannot be inferred and, therefore, must be output in English. You must handle the relationship In, as well as the four compass directions, and whatever is left must come out in some reasonable order (as in the prior step).

Add at least one more filterable trinary spatial relationship to the mix, and filter it. For example, you can do Between (which is static, involving one visitor position and two buildings). Or do MovingToward (which is dynamic, involving the visitor's present location, the visitor's prior location, and one building), or MovingAlongSideOF (which is similar). Make sure you document your reasoning, particularly if you choose something other than the two suggested above.