Ir al contenido

Point

Defined in: geometry/Point.ts:4

A 2D point with x and y coordinates.

new Point(x, y): Point

Defined in: geometry/Point.ts:8

number

number

Point

x: number

Defined in: geometry/Point.ts:5


y: number

Defined in: geometry/Point.ts:6

add(other): Point

Defined in: geometry/Point.ts:102

Add another point to this point.

Point

Point


angle(): number

Defined in: geometry/Point.ts:153

Calculate the angle in radians from the positive x-axis.

number


clone(): Point

Defined in: geometry/Point.ts:48

Return a copy of this point.

Point


copy(): Point

Defined in: geometry/Point.ts:53

GoJS-compatible: Return a copy of this point.

Point


cross(other): number

Defined in: geometry/Point.ts:97

GoJS-compatible: The cross product with another point (x1y2 - y1x2).

Point

number


distance(other): number

Defined in: geometry/Point.ts:70

GoJS-compatible: The distance to another point.

Point

number


distanceSquared(other): number

Defined in: geometry/Point.ts:63

GoJS-compatible: The squared distance to another point.

Point

number


distanceSquaredTo(other): number

Defined in: geometry/Point.ts:124

Calculate the squared distance to another point (faster, no sqrt).

Point

number


distanceTo(other): number

Defined in: geometry/Point.ts:117

Calculate the distance to another point.

Point

number


dot(other): number

Defined in: geometry/Point.ts:148

Calculate the dot product with another point.

Point

number


equals(other): boolean

Defined in: geometry/Point.ts:38

Check if this point equals another point.

Point

boolean


equalsApprox(other, tolerance?): boolean

Defined in: geometry/Point.ts:43

Check if this point is approximately equal to another within a tolerance.

Point

number = 0.0001

boolean


isFinite(): boolean

Defined in: geometry/Point.ts:165

Check if this point is finite.

boolean


isNaN(): boolean

Defined in: geometry/Point.ts:82

GoJS-compatible: Whether either coordinate is NaN.

boolean


isZero(): boolean

Defined in: geometry/Point.ts:170

Check if this point is the zero point.

boolean


length(): number

Defined in: geometry/Point.ts:131

Calculate the length (magnitude) of this point as a vector.

number


lengthSquared(): number

Defined in: geometry/Point.ts:136

Calculate the squared length of this point as a vector.

number


multiply(other): Point

Defined in: geometry/Point.ts:77

GoJS-compatible: Component-wise multiply (xp.x, yp.y).

Point

Point


normalize(): Point

Defined in: geometry/Point.ts:141

Normalize this point to unit length.

Point


offset(dx, dy): Point

Defined in: geometry/Point.ts:58

GoJS-compatible: Return a new point offset by (dx, dy).

number

number

Point


rotate(angle): Point

Defined in: geometry/Point.ts:158

Rotate this point around the origin by the given angle in radians.

number

Point


scale(factor): Point

Defined in: geometry/Point.ts:112

Scale this point by a factor.

number

Point


subtract(other): Point

Defined in: geometry/Point.ts:107

Subtract another point from this point.

Point

Point


toJSON(): object

Defined in: geometry/Point.ts:175

Convert to a plain object.

object

x: number

y: number


toString(): string

Defined in: geometry/Point.ts:185

string


static from(obj): Point

Defined in: geometry/Point.ts:14

Create a Point from an object with x and y properties.

number

number

Point


static fromJSON(data): Point

Defined in: geometry/Point.ts:180

Create a Point from a JSON string or object.

string | { x: number; y: number; }

Point


static of(value): Point

Defined in: geometry/Point.ts:33

Create a point where x === y.

number

Point


static parse(value): Point

Defined in: geometry/Point.ts:24

GoJS-compatible: Parse a string like “100, 200” or “100 200”.

string

Point


static polar(length, angle): Point

Defined in: geometry/Point.ts:87

GoJS-compatible: Create a point on a circle of the given radius at the given angle (radians).

number

number

Point


static random(): Point

Defined in: geometry/Point.ts:92

GoJS-compatible: Create a random point with coordinates in [0, 1).

Point


static zero(): Point

Defined in: geometry/Point.ts:19

Create a zero point (0, 0).

Point