Returns true if both x and y values are zero.
Returns true if both x and y values are equal to zero to within 4 decimal places of precision.
Length is the hypotenuse of the x and y values.
A Vect2d instance can optionally be constructed from another PointType object (with 'x' and 'y' properties),
or from numeric x[,y]
arguments (see set()
for details).
A Vect2d
constructed with no arguments has both x
and y
set to 0
.
Optional
xOrPt: number | PointTypeOptional
y: numberSets the x and y values of this Vect2d instance. The first parameter can be any object containing 'x' and 'y' properties, or a numeric value for the 'x' value. In the latter case, if a 2nd parameter is passed, it is assigned to the 'y' value; otherwise the first parameter is used for both 'x' and 'y' values.
Optional
y: numberReturns a new Vect2d with this instance's x
and y
values.
Swaps the x
and y
values of this vector and returns it.
Returns a new Vect2d
object with the x
and y
values of this vector swapped.
Returns true is this Vect2d equals the given Vect2d or x & y values.
Optional
y: numberReturns true is this Vect2d equals the given PointType to within epsilon
decimal places of precision.
Returns a string representation of an object.
Static
addStatic
multiplyStatic
[has
Vect2d
is a concrete implementation of aPointType
class. It is generally slower to create and read than a "plain"PointType
object (eg. fromPoint.new()
), but OTOH is usually faster when being updated/written. UsingVect2d
is generally recommended for stored objects that persist for some time and/or are likely to get modified.