Adds the coordinates of two points together to create a new point.
Adds the coordinates of two points together to create a new point.
The value to add to Point.x.
The value to add to Point.y.
This Point object. Useful for chaining method calls.
Returns the angle between this Point object and another object with public x and y properties.
Returns the angle between this Point object and another object with public x and y properties.
The object to get the angle from this Point to.
Is the given angle in radians (false) or degrees (true)?
The angle between the two objects.
Math.ceil() both the x and y properties of this Point.
Math.ceil() both the x and y properties of this Point.
This Point object.
Clamps this Point object values to be between the given min and max.
Clamps this Point object values to be between the given min and max.
The minimum value to clamp this Point to.
The maximum value to clamp this Point to.
This Point object.
Clamps the x value of this Point to be between the given min and max.
Clamps the x value of this Point to be between the given min and max.
The minimum value to clamp this Point to.
The maximum value to clamp this Point to.
This Point object.
Clamps the y value of this Point to be between the given min and max.
Clamps the y value of this Point to be between the given min and max.
The minimum value to clamp this Point to.
The maximum value to clamp this Point to.
This Point object.
Creates a copy of the given Point.
Creates a copy of the given Point.
Optional Point object. If given the values will be set into this object, otherwise a brand new Point object will be created and returned.
The new Point object.
Copies the x and y properties from any given object to this Point.
Copies the x and y properties from any given object to this Point.
The object to copy from.
This Point object.
Copies the x and y properties from this Point to any given object.
Copies the x and y properties from this Point to any given object.
The object to copy to.
The dest object.
The cross product of this and another Point object.
The cross product of this and another Point object.
The Point object to get the cross product combined with
The result.
Returns the distance of this Point object to the given object (can be a Circle, Point or anything with x/y properties)
Returns the distance of this Point object to the given object (can be a Circle, Point or anything with x/y properties)
The target object. Must have visible x and y properties that represent the center of the object.
Round the distance to the nearest integer (default false).
The distance between this Point object and the destination Point object.
Divides Point.x and Point.y by the given x and y values.
Divides Point.x and Point.y by the given x and y values.
The value to divide Point.x by.
The value to divide Point.x by.
This Point object. Useful for chaining method calls.
The dot product of this and another Point object.
The dot product of this and another Point object.
The Point object to get the dot product combined with this Point.
The result.
Determines whether the given objects x/y values are equal to this Point object.
Determines whether the given objects x/y values are equal to this Point object.
The object to compare with this Point.
A value of true if the x and y points are equal, otherwise false.
Math.floor() both the x and y properties of this Point.
Math.floor() both the x and y properties of this Point.
This Point object.
Calculates the length of the Point object.
Calculates the length of the Point object.
The length of the Point.
Calculates the length squared of the Point object.
Calculates the length squared of the Point object.
The
length ^ 2
Inverts the x and y values of this Point
Inverts the x and y values of this Point
This Point object.
Determine if this point is at 0,0.
Determine if this point is at 0,0.
True if this Point is 0,0, otherwise false.
Multiplies Point.x and Point.y by the given x and y values.
Multiplies Point.x and Point.y by the given x and y values. Sometimes known as Scale.
The value to multiply Point.x by.
The value to multiply Point.x by.
This Point object. Useful for chaining method calls.
Right-hand normalize (make unit length) this Point.
Right-hand normalize (make unit length) this Point.
This Point object.
Alters the Point object so that its length is 1, but it retains the same direction.
Alters the Point object so that its length is 1, but it retains the same direction.
This Point object.
Make this Point perpendicular (90 degrees rotation)
Make this Point perpendicular (90 degrees rotation)
This Point object.
Rotates this Point around the x/y coordinates given to the desired angle.
Rotates this Point around the x/y coordinates given to the desired angle.
The x coordinate of the anchor point.
The y coordinate of the anchor point.
The angle in radians (unless asDegrees is true) to rotate the Point to.
Is the given angle in radians (false) or degrees (true)?
An optional distance constraint between the Point and the anchor.
The modified point object.
Make this Point perpendicular (-90 degrees rotation)
Make this Point perpendicular (-90 degrees rotation)
This Point object.
Sets the x and y values of this Point object to the given values.
Sets the x and y values of this Point object to the given values. If you omit the y value then the x value will be applied to both, for example: Point.set(2) is the same as Point.set(2, 2)
The horizontal value of this point.
The vertical value of this point. If not given the x value will be used in its place.
This Point object. Useful for chaining method calls.
Alters the length of the Point without changing the direction.
Alters the length of the Point without changing the direction.
The desired magnitude of the resulting Point.
This Point object.
Sets the x and y values of this Point object to the given values.
Sets the x and y values of this Point object to the given values. If you omit the y value then the x value will be applied to both, for example: Point.setTo(2) is the same as Point.setTo(2, 2)
The horizontal value of this point.
Optional: The vertical value of this point. If not given the x value will be used in its place.
This Point object. Useful for chaining method calls.
Subtracts the given x and y values from this Point.
Subtracts the given x and y values from this Point.
The value to subtract from Point.x.
The value to subtract from Point.y.
This Point object. Useful for chaining method calls.
A Point object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis. The following code creates a point at (0,0):
You can also use them as 2D Vectors and you'll find different vector related methods in this class.