Atlas Engine
API Referenceatlasatlas/units

Position2d

Two-component value. Arithmetic returns new values; up is +Y.

Module: atlas/units

Two-component value. Arithmetic returns new values; up is +Y.

Declaration

export class Position2d { ... }

Constructors

constructor(x: number, y: number);

Properties

x

x: number;

y

y: number;

Methods

zero

static zero(): Position2d;

up

static up(): Position2d;

down

static down(): Position2d;

left

static left(): Position2d;
static right(): Position2d;

invalid

Returns a value whose coordinate components are NaN.

static invalid(): Position2d;

add

Returns a new value by adding the operand component-wise; a numeric operand applies to every component.

add(other: Position2d | number): Position2d;

subtract

Returns a new value by subtracting the operand component-wise; a numeric operand applies to every component.

subtract(other: Position2d | number): Position2d;

multiply

Returns a new value by multiplying by the operand component-wise; a numeric operand applies to every component.

multiply(other: Position2d | number): Position2d;

divide

Returns a new value by dividing by the operand component-wise; a numeric operand applies to every component.

divide(other: Position2d | number): Position2d;

is

Tests exact equality of all components.

is(other: Position2d): boolean;

On this page