Jump to content

Rebol Programming/overlap?

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
OVERLAP? f1 f2 

DESCRIPTION:

[edit | edit source]

Returns TRUE if faces overlap each other.

OVERLAP? is a function value.

ARGUMENTS:

[edit | edit source]
  • f1 -- (Type: any)
  • f2 -- (Type: any)

SOURCE CODE

[edit | edit source]
overlap?: func [
    "Returns TRUE if faces overlap each other." 
    f1 f2
][
    found? all [
        f1/offset/x < (f2/offset/x + f2/size/x) 
        f1/offset/y < (f2/offset/y + f2/size/y) 
        (f1/offset/x + f1/size/x) > f2/offset/x 
        (f1/offset/y + f1/size/y) > f2/offset/y
    ]
]