Name: intersect

Type: function

Syntax: intersect(<object>, <object> [, <threshold>] )

Summary:
<return|Returns> true if two <object|objects> overlap, false otherwise.

Introduced: 1.0

OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
intersect(field "Comment",the selectedField)

Example:
if intersect(button "target", button "crosshairs") then flashScreen

Example:
if intersect(graphic "spaceship", graphic "asteroid", "opaque pixels") then endGame

Example:
answer intersect(image "gradient", grc "solid",125)

Parameters:
object:
an object reference.

threshold (enum):
The amount of transparency that pixels in the objects must have in order
to be counted during the intersect calculation. Alternative (readable)
theshold options

-   "alpha value": An integer between 0 and 255 which specifies a
    threshold that the alpha value of each pixel must be greater than or
    equal to in order to be counted during calculation of the intersect.
-   "bounds": (Equivalent to using an alpha value of 0) Specifies that
    the intersect is calculated using the rect of the two objects.
-   "pixels": (Equivalent to using an alpha value of 1) Specifies that
    the intersect is calculated using pixels of the objects that have
    are not completely transparent, ignoring completely transparent
    areas. 
-   "opaque pixels": (Equivalent to using an alpha value of 255)
    Specifies that the intersect is calculated using only pixels that
    are completely opaque.


Returns (bool):
The <intersect> <function> <return|returns> true or false.

Description:
Use the <intersect> <function> to determine whether one
<object(glossary)> obscures part of another <object(glossary)>, or
whether one <object(glossary)> is over another <object(glossary)>.

If both objects are <stacks> or <card(object)|cards>, the <intersect>
<function> <return(glossary)|returns> true if the <stack window|stack
windows> overlap.

The <intersect> <function> uses screen coordinates for <stacks> and
<card(object)|cards>, and <relative coordinates|window coordinates> for
<control(object)|controls>. This means that if one <object(glossary)> is
a <stack> or <card(keyword)> and the other is a <control(keyword)>, the
<intersect> <function> does not <return(constant)> a reliable result.

References: return (constant), function (control structure),
within (function), stacks (function), control (glossary), 
relative coordinates (glossary), return (glossary), 
stack window (glossary), object (glossary), card (keyword), 
control (keyword), card (object), stack (object), layer (property)

Tags: ui

