Skip to content

Point

Defined in: src/Point.ts:13

Adaptation of work of Kevin Lindsey(kevin@kevlindev.com)

new Point(): Point

Defined in: src/Point.ts:18

Point

new Point(x, y): Point

Defined in: src/Point.ts:19

number

number

Point

new Point(point?): Point

Defined in: src/Point.ts:20

XY

Point

x: number

Defined in: src/Point.ts:14

XY.x


y: number

Defined in: src/Point.ts:16

XY.y

add(that): Point

Defined in: src/Point.ts:36

Adds another point to this one and returns a new one with the sum

XY

Point

new Point instance with added values


addEquals(that): Point

Defined in: src/Point.ts:46

Adds another point to this one

XY

Point

thisArg


clone(): Point

Defined in: src/Point.ts:337

return a cloned instance of the point

Point


distanceFrom(that): number

Defined in: src/Point.ts:240

Returns distance from this point and another one

XY

number


divide(that): Point

Defined in: src/Point.ts:150

Divides this point by another and returns a new one

XY

Point


eq(that): boolean

Defined in: src/Point.ts:180

Returns true if this point is equal to another one

XY

boolean


gt(that): boolean

Defined in: src/Point.ts:208

Returns true if this point is greater another one

XY

boolean


gte(that): boolean

Defined in: src/Point.ts:217

Returns true if this point is greater than or equal to another one

XY

boolean


lerp(that, t): Point

Defined in: src/Point.ts:227

Returns new point which is the result of linear interpolation with this one and another one

XY

number = 0.5

, position of interpolation, between 0 and 1 default 0.5

Point


lt(that): boolean

Defined in: src/Point.ts:189

Returns true if this point is less than another one

XY

boolean


lte(that): boolean

Defined in: src/Point.ts:198

Returns true if this point is less than or equal to another one

XY

boolean


max(that): Point

Defined in: src/Point.ts:269

Returns a new point which is the max of this and another one

XY

Point


midPointFrom(that): Point

Defined in: src/Point.ts:251

Returns the point between this point and another one

XY

Point


min(that): Point

Defined in: src/Point.ts:260

Returns a new point which is the min of this and another one

XY

Point


multiply(that): Point

Defined in: src/Point.ts:120

Multiplies this point by another value and returns a new one

XY

Point


rotate(radians, origin): Point

Defined in: src/Point.ts:347

Rotates point around origin with radians

TRadian

The radians of the angle for the rotation

XY = ZERO

The origin of the rotation

Point

The new rotated point


scalarAdd(scalar): Point

Defined in: src/Point.ts:57

Adds value to this point and returns a new one

number

Point

new Point with added value


scalarAddEquals(scalar): Point

Defined in: src/Point.ts:67

Adds value to this point

number

Point

thisArg


scalarDivide(scalar): Point

Defined in: src/Point.ts:159

Divides this point by a value and returns a new one

number

Point


scalarDivideEquals(scalar): Point

Defined in: src/Point.ts:169

Divides this point by a value

number

Point

thisArg


scalarMultiply(scalar): Point

Defined in: src/Point.ts:129

Multiplies this point by a value and returns a new one

number

Point


scalarMultiplyEquals(scalar): Point

Defined in: src/Point.ts:139

Multiplies this point by a value

number

Point

thisArg


scalarSubtract(scalar): Point

Defined in: src/Point.ts:99

Subtracts value from this point and returns a new one

number

Point


scalarSubtractEquals(scalar): Point

Defined in: src/Point.ts:109

Subtracts value from this point

number

Point

thisArg


setFromPoint(that): Point

Defined in: src/Point.ts:314

Sets x/y of this point from another point

XY

Point


setX(x): Point

Defined in: src/Point.ts:296

Sets x of this point

number

Point


setXY(x, y): Point

Defined in: src/Point.ts:286

Sets x/y of this point

number

number

Point


setY(y): Point

Defined in: src/Point.ts:305

Sets y of this point

number

Point


subtract(that): Point

Defined in: src/Point.ts:78

Subtracts another point from this point and returns a new one

XY

Point

new Point object with subtracted values


subtractEquals(that): Point

Defined in: src/Point.ts:88

Subtracts another point from this point

XY

Point

thisArg


swap(that): void

Defined in: src/Point.ts:324

Swaps x/y of this point and another point

XY

void


toString(): string

Defined in: src/Point.ts:277

Returns string representation of this point

string


transform(t, ignoreOffset?): Point

Defined in: src/Point.ts:366

Apply transform t to point p

TMat2D

The transform

boolean = false

Indicates that the offset should not be applied

Point

The transformed point