Phaser API Documentation

  Version: 

Member of: Phaser.Geom.Point

<static> GetCentroid(points, [out])

Description:

Get the centroid or geometric center of a plane figure (the arithmetic mean position of all the points in the figure). Informally, it is the point at which a cutout of the shape could be perfectly balanced on the tip of a pin.

Parameters:

name type arguments description
points Array.<Phaser.Types.Math.Vector2Like>

An array of Vector2Like objects to get the geometric center of.

out Phaser.Geom.Point <optional>

A Point object to store the output coordinates in. If not given, a new Point instance is created.

Returns:
Description:

A Point object representing the geometric center of the given points.

Since: 3.0.0