Point$Typings extension

on

Properties

x num
Gets or sets the x value of the Point.
getter/setter pair
y num
Gets or sets the y value of the Point.
getter/setter pair

Methods

add(Point p) Point
Modify this point so that is the sum of the current Point and the x and y co-ordinates of the given Point. @param {Point} p The Point to add to this Point. @return {Point} this. @see #offset @see #subtract
compareWithLineSegmentPoint(Point p, Point q) num
Compare this point with a finite line segment given by two Points.
copy() Point
Create a copy of this Point, with the same values. @expose @return {Point}
direction(num px, num py) num
Compute the angle from this Point to a given (px,py) point. However, if the point is the same as this Point, the direction is zero. @param {number} px @param {number} py @return {number} the angle, in degrees, of the line from this Point to the given point. @see #directionPoint
directionPoint(Point p) num
Compute the angle from this Point to a given Point. However, if the given Point is the same as this Point, the direction is zero. @param {Point} p the other Point to which to measure the relative angle. @return {number} the angle, in degrees, of the line from this Point to the given point. @see #direction
distanceSquared(num px, num py) num
Returns the square of the distance from this point to a given point (px, py). @param {number} px @param {number} py @return {number} the square of the euclidean distance. @see #distanceSquaredPoint
distanceSquaredPoint(Point p) num
Returns the square of the distance from this Point to a given Point. @param {Point} p the other Point to measure to. @return {number} the square of the euclidean distance. @see #distanceSquared
equals(Point p) bool
Indicates whether the given Point is equal to this Point. @param {Point} p The Point to compare to the current Point. @return {boolean} True if the two Points have identical X and Y values, false otherwise. @see #equalTo
equalsApprox(Point p) bool
(undocumented) True when the given Point is nearly equal to this Point. @param {Point} p The Point to compare to the current Point. @return {boolean} True if the two Points have X and Y values that are equal with a tolerance of 0.5, false otherwise.
equalTo(num x, num y) bool
Indicates whether the given point (x, y) is equal to this Point. @param {number} x @param {number} y @return {boolean} True if the two Points have identical X and Y values, false otherwise. @see #equals
isReal() bool
True if this Point has X and Y values that are real numbers and not infinity. @return {boolean}
normalize() Point
Modify this Point so that its X and Y values have been normalized to a unit length. However, if this Point is the origin (zero, zero), its length remains zero. @return {Point} this.
offset(num dx, num dy) Point
Modify this point by shifting its values with the given DX and DY offsets. @param {number} dx @param {number} dy @return {Point} this. @see #add @see #subtract
projectOntoLineSegment(num px, num py, num qx, num qy) Point
Modify this point to be the closest point to this point that is on a finite line segment. @param {number} px one end of the finite line segment @param {number} py one end of the finite line segment @param {number} qx the other end of the finite line segment @param {number} qy the other end of the finite line segment @return {Point} this modified Point @since 1.3
projectOntoLineSegmentPoint(Point p, Point q) Point
Modify this point to be the closest point to this point that is on a finite line segment. @param {Point} p one end of the finite line segment @param {Point} q the other end of the finite line segment @return {Point} this modified Point @since 1.3
rotate(num angle) Point
Modify this Point so that has been rotated about the origin by the given angle. @param {number} angle an angle in degrees. @return {Point} this.
scale(num sx, num sy) Point
Modify this Point so that its X and Y values have been scaled by given factors along the X and Y axes. @param {number} sx @param {number} sy @return {Point} this.
set(Point p) Point
Modify this Point so that its X and Y values are the same as the given Point. @param {Point} p the given Point. @return {Point} this.
setRectSpot(Rect r, Spot spot) Point
Modify this Point so that its X and Y values correspond to a particular Spot in a given Rect.
setSpot(num x, num y, num w, num h, Spot spot) Point
Modify this Point so that its X and Y values correspond to a particular Spot in a given rectangle.
setTo(num x, num y) Point
Modify this Point with new X and Y values. @param {number} x @param {number} y @return {Point} this.
snapToGrid(num originx, num originy, num cellwidth, num cellheight) Point
Modify this point to be at the nearest point on an infinite grid, given the grid's origin and size of each grid cell. @param {number} originx the top-left point of one of the grid cells @param {number} originy the top-left point of one of the grid cells @param {number} cellwidth the size of each grid cell -- must be a real number larger than zero @param {number} cellheight the size of each grid cell -- must be a real number larger than zero @return {Point} this modified Point @since 1.3
snapToGridPoint(Point origin, Size cellsize) Point
Modify this point to be at the nearest point on an infinite grid, given the grid's origin and size of each grid cell. @param {Point} origin the top-left point of one of the grid cells @param {Size} cellsize the size of each grid cell @return {Point} this modified Point @since 1.3
subtract(Point p) Point
Modify this point so that is the difference of this Point and the x and y co-ordinates of the given Point. @param {Point} p The Point to subtract from the current Point. @return {Point} this. @see #offset @see #add