intersectionrectangle(
RECTANGLE1
,
RECTANGLE2
)

The intersectionrectangle( function creates a rectangle by combining two rectangles. The new rectangle is the area where the two rectangles overlap (if any).


Parameters

This function has two parameters:

rectangle1 – is the first rectangle.

rectangle2 – is the second rectangle.


Description

The intersectionrectangle( function creates a rectangle by combining two rectangles. The new rectangle is the area where the two rectangles overlap (if any). If these two rectangles do not touch each other the function will return an empty rectangle (the same as rectangle(0,0,0,0) ). A rectangle is a raw binary data value (see Binary Data, Graphic Coordinates).

The illustration below shows how this function combines two rectangles, creating a third rectangle where the original two rectangles overlap:

intersectionrectangle()
intersectionrectangle()

The intersectionrectangle( function can be used to check if two rectangles overlap each other. The procedure below checks to see if the current window is on the main screen, or if it is on another screen.

if intersectionrectangle(
        info("windowrectangle"),
        info("screenrectangle")) = rectangle(0,0,0,0)
    message "This window is completely off the main screen"
else
    message "This window is partially on the main screen"
endif

See Also


History

VersionStatusNotes
10.0UpdatedUnlike Panorama 6 and earlier, the parameters to this function are floating point values instead of integers (it will also accept integers). Also, the rectangle produced by this function is a 32 byte binary value, instead of an 8 byte text value.