The Overlap function

The Overlap function returns a Boolean value that indicates whether two objects overlap or have at least one point in common.

The following figure shows a circle that overlaps a triangle. The circle, however, does not overlap the box, because the circle does not have any points in common with the box.
Figure 1: Example of a circle that overlaps a triangle

begin figure description - This figure is described in the surrounding text. - end figure description
The signature of the Overlap function must be:
Overlap (UDT, UDT) RETURNS BOOLEAN

UDT refers to user-defined type, or the data type you want to index with the R-tree access method.

The Overlap function returns TRUE if the object in the first parameter overlaps or intersects the object in the second parameter and FALSE otherwise.

When you design the Overlaps function, you might want to first test if the bounding boxes of the two data objects overlap; and if they do, then test if the data objects overlap. The first test is a relatively quick and easy calculation and might eliminate many candidates before the second, more complicated test.

For example, the following figure shows that the first bounding box test eliminates the box-circle overlap immediately, but the second data object test is required to find out if the triangle and circle overlap. In this case, they do not.
Figure 2: Bounding box example of the overlap function

begin figure description - This figure is described in the surrounding text. - end figure description

Shapes3 sample DataBlade module contains sample C code to create an Overlap function that takes the MyShape data type as its two parameters.