Phaser API Documentation

  Version: 
<static> ContainsArray(triangle, points, [returnFirst], [out])

Description:

Filters an array of point-like objects to only those contained within a triangle. If returnFirst is true, will return an array containing only the first point in the provided array that is within the triangle (or an empty array if there are no such points).

Parameters:

name type arguments Default description
triangle Phaser.Geom.Triangle

The triangle that the points are being checked in.

points Array.<Phaser.Geom.Point>

An array of point-like objects (objects that have an x and y property)

returnFirst boolean <optional> false

If true, return an array containing only the first point found that is within the triangle.

out array <optional>

If provided, the points that are within the triangle will be appended to this array instead of being added to a new array. If returnFirst is true, only the first point found within the triangle will be appended. This array will also be returned by this function.

Returns:
Description:

An array containing all the points from points that are within the triangle, if an array was provided as out, points will be appended to that array and it will also be returned here.

Type:
Since: 3.0.0