phaser - v3.90.0
    Preparing search index...

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

    Index

    Constructors

    • Parameters

      • Optionalx: number

        The x coordinate of this Point. Default 0.

      • Optionaly: number

        The y coordinate of this Point. Default x.

      Returns Point

    Properties

    type: number

    The geometry constant type of this object: GEOM_CONST.POINT. Used for fast type comparisons.

    x: number

    The x coordinate of this Point.

    y: number

    The y coordinate of this Point.

    Methods

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

      Parameters

      • Optionalx: number

        The x coordinate of this Point. Default 0.

      • Optionaly: number

        The y coordinate of this Point. Default x.

      Returns this

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

      Type Parameters

      Parameters

      • point: O

        The Point to ceil.

      Returns O

    • Clone the given Point.

      Parameters

      • source: Point

        The source Point to clone.

      Returns Point

    • Copy the values of one Point to a destination Point.

      Type Parameters

      Parameters

      • source: Point

        The source Point to copy the values from.

      • dest: O

        The destination Point to copy the values to.

      Returns O

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

      Parameters

      • point: Point

        The original Point to compare against.

      • toCompare: Point

        The second Point to compare.

      Returns boolean

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

      Type Parameters

      Parameters

      • point: O

        The Point to floor.

      Returns O

    • 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.

      Type Parameters

      Parameters

      • points: Vector2Like[]

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

      • Optionalout: O

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

      Returns O

    • Calculate the magnitude of the point, which equivalent to the length of the line from the origin to this point.

      Parameters

      • point: Point

        The point to calculate the magnitude for

      Returns number

    • Calculates the square of magnitude of given point.(Can be used for fast magnitude calculation of point)

      Parameters

      • point: Point

        Returns square of the magnitude/length of given point.

      Returns number

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

      Type Parameters

      Parameters

      • points: Vector2Like[]

        An array of Vector2Like objects to get the AABB from.

      • Optionalout: O

        A Rectangle object to store the results in. If not given, a new Rectangle instance is created.

      Returns O

    • Returns the linear interpolation point between the two given points, based on t.

      Type Parameters

      Parameters

      • pointA: Point

        The starting Point for the interpolation.

      • pointB: Point

        The target Point for the interpolation.

      • Optionalt: number

        The amount to interpolate between the two points. Generally, a value between 0 (returns the starting Point) and 1 (returns the target Point). If omitted, 0 is used. Default 0.

      • Optionalout: O

        An optional Point object whose x and y values will be set to the result of the interpolation (can also be any object with x and y properties). If omitted, a new Point created and returned.

      Returns O

    • Swaps the X and the Y coordinate of a point.

      Type Parameters

      Parameters

      • point: O

        The Point to modify.

      Returns O

    • Inverts a Point's coordinates.

      Type Parameters

      Parameters

      • point: Point

        The Point to invert.

      • Optionalout: O

        The Point to return the inverted coordinates in.

      Returns O

    • Calculates the vector projection of pointA onto the nonzero pointB. This is the orthogonal projection of pointA onto a straight line parallel to pointB.

      Type Parameters

      Parameters

      • pointA: Point

        Point A, to be projected onto Point B.

      • pointB: Point

        Point B, to have Point A projected upon it.

      • Optionalout: O

        The Point object to store the position in. If not given, a new Point instance is created.

      Returns O

    • Calculates the vector projection of pointA onto the nonzero pointB. This is the orthogonal projection of pointA onto a straight line paralle to pointB.

      Type Parameters

      Parameters

      • pointA: Point

        Point A, to be projected onto Point B. Must be a normalized point with a magnitude of 1.

      • pointB: Point

        Point B, to have Point A projected upon it.

      • Optionalout: O

        The Point object to store the position in. If not given, a new Point instance is created.

      Returns O

    • Changes the magnitude (length) of a two-dimensional vector without changing its direction.

      Type Parameters

      Parameters

      • point: O

        The Point to treat as the end point of the vector.

      • magnitude: number

        The new magnitude of the vector.

      Returns O