2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2020-01-15 12:07:09 +00:00
|
|
|
* @copyright 2020 Photon Storm Ltd.
|
2019-05-10 15:15:04 +00:00
|
|
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
2018-02-12 16:01:20 +00:00
|
|
|
*/
|
|
|
|
|
2017-01-07 01:06:57 +00:00
|
|
|
var Contains = require('./Contains');
|
|
|
|
|
2017-10-13 13:11:54 +00:00
|
|
|
/**
|
2020-02-04 16:19:42 +00:00
|
|
|
* Checks the given Point again the Polygon to see if the Point lays within its vertices.
|
2017-10-13 13:11:54 +00:00
|
|
|
*
|
|
|
|
* @function Phaser.Geom.Polygon.ContainsPoint
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2020-02-04 16:19:42 +00:00
|
|
|
* @param {Phaser.Geom.Polygon} polygon - The Polygon to check.
|
|
|
|
* @param {Phaser.Geom.Point} point - The Point to check if it's within the Polygon.
|
2017-10-13 13:11:54 +00:00
|
|
|
*
|
2020-02-04 16:19:42 +00:00
|
|
|
* @return {boolean} `true` if the Point is within the Polygon, otherwise `false`.
|
2017-10-13 13:11:54 +00:00
|
|
|
*/
|
2017-01-07 01:06:57 +00:00
|
|
|
var ContainsPoint = function (polygon, point)
|
|
|
|
{
|
|
|
|
return Contains(polygon, point.x, point.y);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = ContainsPoint;
|