The input value
The x coordinate
The y coordinate
The coordinates
The coordinates (or Point)
The array of size 2.
A new point with both coordinates made positive. This point is left unchanged.
The squared distance from the origin to this point. Cheaper than Function.length since it skips the square root — use it when comparing magnitudes.
StaticdistFirst point
Second point
StaticmidUndetermined number of point parameters
StaticmaxUndetermined number of point parameters
StaticminUndetermined number of point parameters
The coordinates to compare against.
Whether both coordinates match.
Function
bound
The lower bound for both axes.
The upper bound for both axes.
A new clamped point. This point is left unchanged.
Function
bound
The lower bound for x.
The upper bound for x.
Optionaly1: number
The lower bound for y. Defaults to the x bound.
Optionaly2: number
The upper bound for y. Defaults to the x bound.
A new clamped point. This point is left unchanged.
The value to add to both x and y
A new point holding the result. This point is left unchanged.
The value to add to the x coordinate
The value to add to the y coordinate
A new point holding the result. This point is left unchanged.
The coordinates to add
A new point holding the result. This point is left unchanged.
The value to subtract from both x and y
A new point holding the result. This point is left unchanged.
The value to subtract from the x coordinate
The value to subtract from the y coordinate
A new point holding the result. This point is left unchanged.
The coordinates to subtract
A new point holding the result. This point is left unchanged.
The value to multiply both x and y
A new point holding the result. This point is left unchanged.
The value to multiply the x coordinate
The value to multiply the y coordinate
A new point holding the result. This point is left unchanged.
The coordinates to multiply
A new point holding the result. This point is left unchanged.
The value to divide both x and y
A new point holding the result. This point is left unchanged.
The value to divide the x coordinate
The value to divide the y coordinate
A new point holding the result. This point is left unchanged.
The coordinates to divide with
A new point holding the result. This point is left unchanged.
The value to mod both x and y
A new point holding the result. This point is left unchanged.
The value to mod the x coordinate
The value to mod the y coordinate
A new point holding the result. This point is left unchanged.
The coordinates to mod with
A new point holding the result. This point is left unchanged.
Function
dot
The other vector.
The dot product. Zero means the two are perpendicular.
Function
positionOnSegment
A value from 0 (at the start) to 1 (at the end), clamped to that range.
Returns 0 for a zero-length segment.
StaticlinearFunction
toString
The serialized point, e.g. '{"x":1,"y":2}'.
Serialize this point to a JSON string, in the form Point.fromString reads.
StaticfromFunction
from
The string to parse.
The parsed point, or undefined if the string is not valid JSON holding numeric
x and y fields.
Parse a point from a JSON string produced by Function.toString.
Function
fromString
The string to parse.
The parsed point, or undefined if the string is not valid JSON holding numeric
x and y fields.
Parse a point from a JSON string produced by Function.toString. Delegates to
Point.from; it exists as an instance method because GradumInput discovers a value's
parser by looking for fromString on the value itself, which a static member would not satisfy.
Description
Create a point with coordinates (0, 0)