Class: Point

Phaser.Geom. Point

Defines a Point in 2D space, with an x and y component.


new Point( [x] [, y])

Parameters:
Name Type Argument Default Description
x number <optional>
0

The x coordinate of this Point.

y number <optional>
x

The y coordinate of this Point.

Since: 3.0.0
Source: src/geom/point/Point.js (Line 9)

Members


x :number

The x coordinate of this Point.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/geom/point/Point.js (Line 30)

y :number

The y coordinate of this Point.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/geom/point/Point.js (Line 40)

Methods


<static> Ceil(point)

Apply Math.ceil() to each coordinate of the given Point.

Parameters:
Name Type Description
point Phaser.Geom.Point

The Point to ceil.

Since: 3.0.0
Source: src/geom/point/Ceil.js (Line 7)
Returns:

The Point with Math.ceil() applied to its coordinates.

Type
Phaser.Geom.Point

<static> Clone(source)

Clone the given Point.

Parameters:
Name Type Description
source Phaser.Geom.Point

The source Point to clone.

Since: 3.0.0
Source: src/geom/point/Clone.js (Line 9)
Returns:

The cloned Point.

Type
Phaser.Geom.Point

<static> CopyFrom(source, dest)

Copy the values of one Point to a destination Point.

Parameters:
Name Type Description
source Phaser.Geom.Point

The source Point to copy the values from.

dest Phaser.Geom.Point

The destination Point to copy the values to.

Since: 3.0.0
Source: src/geom/point/CopyFrom.js (Line 7)
Returns:

The destination Point.

Type
Phaser.Geom.Point

<static> Equals(point, toCompare)

A comparison of two Point objects to see if they are equal.

Parameters:
Name Type Description
point Phaser.Geom.Point

The original Point to compare against.

toCompare Phaser.Geom.Point

The second Point to compare.

Since: 3.0.0
Source: src/geom/point/Equals.js (Line 7)
Returns:

Returns true if the both Point objects are equal.

Type
boolean

<static> Floor(point)

Apply Math.ceil() to each coordinate of the given Point.

Parameters:
Name Type Description
point Phaser.Geom.Point

The Point to floor.

Since: 3.0.0
Source: src/geom/point/Floor.js (Line 7)
Returns:

The Point with Math.floor() applied to its coordinates.

Type
Phaser.Geom.Point

<static> GetCentroid(points [, out])

[description]

Parameters:
Name Type Argument Description
points Array.<Phaser.Geom.Point>

[description]

out Phaser.Geom.Point <optional>

[description]

Since: 3.0.0
Source: src/geom/point/GetCentroid.js (Line 9)
Returns:

[description]

Type
Phaser.Geom.Point

<static> GetMagnitude(point)

[description]

Parameters:
Name Type Description
point Phaser.Geom.Point

[description]

Since: 3.0.0
Source: src/geom/point/GetMagnitude.js (Line 7)
Returns:

[description]

Type
number

<static> GetMagnitudeSq(point)

[description]

Parameters:
Name Type Description
point Phaser.Geom.Point

[description]

Since: 3.0.0
Source: src/geom/point/GetMagnitudeSq.js (Line 7)
Returns:

[description]

Type
number

<static> GetRectangleFromPoints(points [, out])

Calculates the Axis Aligned Bounding Box (or aabb) from an array of points.

Parameters:
Name Type Argument Description
points Array.<Phaser.Geom.Point>

[description]

out Phaser.Geom.Rectangle <optional>

[description]

Since: 3.0.0
Source: src/geom/point/GetRectangleFromPoints.js (Line 9)
Returns:

[description]

Type
Phaser.Geom.Rectangle

<static> Interpolate(pointA, pointB [, t] [, out])

Interpolate two given Point objects, based on t value. Return result either as new Point if out parameter is omitted or load result into Point passed as out parameter and return it. For out parameter you can also use any object with public x/y properties.

Parameters:
Name Type Argument Default Description
pointA Phaser.Geom.Point

[description]

pointB Phaser.Geom.Point

[description]

t number <optional>
0

[description]

out Phaser.Geom.Point | object <optional>

[description]

Since: 3.0.0
Source: src/geom/point/Interpolate.js (Line 9)
Returns:

[description]

Type
Phaser.Geom.Point | object

<static> Invert(point)

Swaps the X and the Y coordinate of a point.

Parameters:
Name Type Description
point Phaser.Geom.Point

The Point to modify.

Since: 3.0.0
Source: src/geom/point/Invert.js (Line 7)
Returns:

The modified point.

Type
Phaser.Geom.Point

<static> Negative(point [, out])

[description]

Parameters:
Name Type Argument Description
point Phaser.Geom.Point

[description]

out Phaser.Geom.Point <optional>

[description]

Since: 3.0.0
Source: src/geom/point/Negative.js (Line 9)
Returns:

[description]

Type
Phaser.Geom.Point

<static> Project(pointA, pointB [, out])

[description]

Parameters:
Name Type Argument Description
pointA Phaser.Geom.Point

[description]

pointB Phaser.Geom.Point

[description]

out Phaser.Geom.Point <optional>

[description]

Since: 3.0.0
Source: src/geom/point/Project.js (Line 10)
Returns:

[description]

Type
Phaser.Geom.Point

<static> ProjectUnit(pointA, pointB [, out])

[description]

Parameters:
Name Type Argument Description
pointA Phaser.Geom.Point

[description]

pointB Phaser.Geom.Point

[description]

out Phaser.Geom.Point <optional>

[description]

Since: 3.0.0
Source: src/geom/point/ProjectUnit.js (Line 9)
Returns:

[description]

Type
Phaser.Geom.Point

<static> SetMagnitude(point, magnitude)

[description]

Parameters:
Name Type Description
point Phaser.Geom.Point

[description]

magnitude number

[description]

Since: 3.0.0
Source: src/geom/point/SetMagnitude.js (Line 9)
Returns:

[description]

Type
Phaser.Geom.Point

setTo( [x] [, y])

Set the x and y coordinates of the point to the given values.

Parameters:
Name Type Argument Default Description
x number <optional>
0

The x coordinate of this Point.

y number <optional>
x

The y coordinate of this Point.

Since: 3.0.0
Source: src/geom/point/Point.js (Line 51)
Returns:

This Point object.

Type
Phaser.Geom.Point