Skip to main content

Home > blockly > utils > Coordinate

utils.Coordinate class

Class for representing coordinates and positions.

Signature:

export declare class Coordinate 

Constructors

ConstructorModifiersDescription
(constructor)(x, y)Constructs a new instance of the Coordinate class

Properties

PropertyModifiersTypeDescription
xnumber
ynumber

Methods

MethodModifiersDescription
clone()Creates a new copy of this coordinate.
difference(a, b)staticReturns the difference between two coordinates as a new Coordinate.
distance(a, b)staticReturns the distance between two coordinates.
equals(a, b)staticCompares coordinates for equality.
magnitude(a)staticReturns the magnitude of a coordinate.
scale(s)Scales this coordinate by the given scale factor.
sum(a, b)staticReturns the sum of two coordinates as a new Coordinate.
translate(tx, ty)Translates this coordinate by the given offsets. respectively.