Phaser API Documentation

  Version: 
<static> Centroid(triangle, [out])

Description:

Calculates the position of a Triangle's centroid, which is also its center of mass (center of gravity).

The centroid is the point in a Triangle at which its three medians (the lines drawn from the vertices to the bisectors of the opposite sides) meet. It divides each one in a 2:1 ratio.

Parameters:

name type arguments description
triangle Phaser.Geom.Triangle

The Triangle to use.

out object | Phaser.Geom.Point <optional>

An object to store the coordinates in.

Returns:
Description:

The out object with modified x and y properties, or a new Point if none was provided.

Type:
Since: 3.0.0