Link Search Menu Expand Document

Point

point.ts#L15

Class Point

A single point class defined by two coordinates x and y.

Implements GeoElement, SimplePoint

constructor (x: number, y: number): Point

Name Type Default Description
x number 0  
y number 0  

readonly Property .type

Default value: 'point'

readonly Property .x : number

Default value: 0

readonly Property .y : number

Default value: 0

Accessor .array

Accessor .flip : Point

Accessor .inverse : Point

Accessor .length : number

Accessor .perpendicular : Point

Accessor .unitVector : Point

Method .add (p: SimplePoint): Point

Name Type Default Description
p SimplePoint    

Method .angle (c: Point): number

Name Type Default Description
c Point  

Method .changeCoordinates (originCoords: Bounds, targetCoords: Bounds): Point

Name Type Default Description
originCoords Bounds    
targetCoords Bounds    

Method .clamp (bounds: Bounds, padding: number): Point

Clamps this point to specific bounds.

Name Type Default Description
bounds Bounds    
padding number 0  

Method .distanceFromLine (l: Line): number

Finds the perpendicular distance between this point and a line.

Name Type Default Description
l Line    

Method .equals (other: any, precision: number): boolean

Name Type Default Description
other any    
precision number    

Method .floor (): Point

Method .mod (x: number, y: number): Point

Name Type Default Description
x number    
y number  

Method .reflect (l: Line): Point

Reflects this point across a line l.

Name Type Default Description
l Line    

Method .rotate (angle: number, c: SimplePoint): Point

Rotates this point by a given angle (in radians) around c.

Name Type Default Description
angle number    
c SimplePoint  

Method .round (inc: number): Point

Name Type Default Description
inc number 1  

Method .scale (sx: number, sy: number): Point

Name Type Default Description
sx number    
sy number  

Method .shift (x: number, y: number): Point

Name Type Default Description
x number    
y number  

Method .snap (p: Point, tolerance: number): Point

Name Type Default Description
p Point    
tolerance number 5  

Method .subtract (p: SimplePoint): Point

Name Type Default Description
p SimplePoint    

Method .transform (m: TransformMatrix): Point

Transforms this point using a 2x3 matrix m.

Name Type Default Description
m TransformMatrix    

Method .translate (p: Point): Point

Name Type Default Description
p Point    

static Method .average (points: Array<SimplePoint>): Point

Calculates the average of multiple points.

Name Type Default Description
points Array<SimplePoint>    

static Method .difference (p1: SimplePoint, p2: SimplePoint): Point

Name Type Default Description
p1 SimplePoint    
p2 SimplePoint    

static Method .distance (p1: SimplePoint, p2: SimplePoint): number

Returns the Euclidean distance between two points p1 and p2.

Name Type Default Description
p1 SimplePoint    
p2 SimplePoint    

static Method .dot (p1: SimplePoint, p2: SimplePoint): number

Calculates the dot product of two points p1 and p2.

Name Type Default Description
p1 SimplePoint    
p2 SimplePoint    

static Method .fromPolar (angle: number, r: number): Point

Creates a point from polar coordinates.

Name Type Default Description
angle number    
r number 1  

static Method .interpolate (p1: SimplePoint, p2: SimplePoint, t: number): Point

Interpolates two points p1 and p2 by a factor of t.

Name Type Default Description
p1 SimplePoint    
p2 SimplePoint    
t number 0.5  

static Method .interpolateList (points: Array<SimplePoint>, t: number): Point

Interpolates a list of multiple points.

Name Type Default Description
points Array<SimplePoint>    
t number 0.5  

static Method .manhattan (p1: SimplePoint, p2: SimplePoint): number

Returns the Manhattan distance between two points p1 and p2.

Name Type Default Description
p1 SimplePoint    
p2 SimplePoint    

static Method .random (b: Bounds): Point

Name Type Default Description
b Bounds    

static Method .sum (p1: SimplePoint, p2: SimplePoint): Point

Name Type Default Description
p1 SimplePoint    
p2 SimplePoint    
point.ts#L206

ORIGIN : Point

Default value: ...


Copyright © 2021 Mathigon.org