Structural Hits for Storage Tube Displays
The final topic is to consider how to obtain structural hit information using a storage tube display or device which only gives absolute x, y screen information.
The problem is to take an x, y coordinate pair and determine if the user is or is not pointing at an object on the screen, and if he is, which object. When a hit is generated with the light pen, the display processor halts and the controlling computer can gain access to the return addresses in the push down stack and to the instruction location which generated the line or character causing the hit. Use of the Joy Stick, Mouse, or tablet is completely asynchronous with the display for refresh displays and the hit occurs after the drawing has taken place for storage tube systems.
The brute force approach to the problem would be to simulate execution of the Display Buffer and calculate some measure of distance between every line and the x, y coordinate of the hit. This approach would be too time consuming and is not feasible. A second approach and one commonly used is to have the programmer define a rectangle surrounding each object on the screen. Then one determines which rectangle the cursor was in and that determines the object hit. This approach requires extra effort by the programmer, and only works well if the node-branch structure is one level deep, there are no diagonal lines as nodes, and no objects have overlapping rectangles. These severe restrictions eliminates this approach from serious consideration.
A third approach would be to break the screen into small squares or rectangles of a size such that it is unlikely a line from more than one picture object would pass through the square or rectangle. Then we would record for each square the Display Pointer of the lowest level object branch passing through it. This approach would require considerable system space and would take much time to determine what rectangles each line passed through.
The fourth approach and the one we recommend is to split the screen into horizontal and vertical strips. When the call to DISPLAY is given, the system makes one pass through the node-branch structure and makes a list of the Display Pointers for the lowest branch having a node with a line or character passing through or in each horizontal or vertical strip.
This calculation can be made quickly because the system can easily obtain the start and end points of a line. One then can quickly determine which strips the end points fall in, as well as the intermediate strips crossed. When a hit is generated, the x, y information is converted to horizontal and vertical strip numbers. The Display Pointers for each of these strips are intersected to see if a common Display Pointer exists. If yes, this is the Display Pointer for the object hit. If not, then a null hit is generated. Choice of strip width decreases the probability of multiple hits resulting.
The above process yields the Display Pointer of the lowest branch in the tree in view, but one may want to obtain information about other higher branches in view. This is accomplished by creating, not only the strip lists described, but by parsing the node-branch structure at the same time into a table containing an abbreviated representation of the tree and the screen x, y coordinates existing at each branch. The strip lists do not actually contain Display Pointers, but pointers back into the parsed representations which has the Display Pointer, x, y coordinates, and the structure level for each of the branches. The parsed representation is a linear list of the branches encountered as the program walks through the node-branch graph. Given the hit at the lowest level one can determine all branches passed through from the top node to the hit branch by an upward search of the graph representation.
Every time a branch is deleted or a new branch is added, one needs to modify the screen, modify the representations and the strip lists. For refresh displays, the picture can be changed immediately and the strip lists and representations modified at the time of an attention call. For a storage display, erasing and redrawing the picture on each deletion can be slow, if many deletions are going on, and may be unnecessary.
There are three approaches to performing these functions in storage tube systems:
-
Erase the screen on each deletion and recompute the picture, strip lists and graph representations on each deletion and addition.
-
Keep a list of each Display Buffer change and perform erase if necessary and redraw or make an addition when an attention call is encountered. This is a feasible approach because it is only at this point that the screen and structural hit information need to be up to date.
-
The third is to allow control of screen changes and other updating by special subroutine call. The recommended approach uses a combination of the above. Adding information to the screen should occur at the time of the new branch call. Deletions and modifications of the representation and the strip lists occur only at the time of an attention call. Routines should also be provided to give the programmer control over this redraw mechanism.
Experience with the above mechanism has shown it to be quite fast and not to noticeably degrade response time. One minor difficulty has been encountered when a horizontal or vertical line of an object is on the borderline of a strip. Sometimes this results in a null hit being generated if the cursor is on the wrong side of the borderline. A check can be made for this condition and audio feedback can be given to the user with the bell in the terminal to indicate a correct or erroneous hit.