Table of contents
class Vec {}

Constructor

Constructs a new instance of the Vec class

Parameters
NameDescription

x

number

y

number

z

number

Properties

pressure

get pressure(): number

x

x: number

y

y: number

z

z: number

Methods

Abs()

static Abs(A: VecLike): Vec
Parameters
NameDescription

A

VecLike
Returns
Vec

Add()

static Add(A: VecLike, B: VecLike): Vec
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
Vec

AddScalar()

static AddScalar(A: VecLike, n: number): Vec
Parameters
NameDescription

A

VecLike

n

number
Returns
Vec

AddXY()

static AddXY(A: VecLike, x: number, y: number): Vec
Parameters
NameDescription

A

VecLike

x

number

y

number
Returns
Vec

Angle()

static Angle(A: VecLike, B: VecLike): number
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
number

Average()

static Average(arr: VecLike[]): Vec
Parameters
NameDescription

arr

VecLike[]
Returns
Vec

Cast()

static Cast(A: VecLike): Vec
Parameters
NameDescription

A

VecLike
Returns
Vec

Clamp()

static Clamp(A: Vec, min: number, max?: number): Vec
Parameters
NameDescription

A

Vec

min

number

max

number
Returns
Vec

Clockwise()

static Clockwise(A: VecLike, B: VecLike, C: VecLike): boolean
Parameters
NameDescription

A

VecLike

B

VecLike

C

VecLike
Returns
boolean

Cpr()

Cross product of two vectors which is used to calculate the area of a parallelogram.

static Cpr(A: VecLike, B: VecLike): number
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
number

Cross()

static Cross(A: VecLike, V: VecLike): Vec
Parameters
NameDescription

A

VecLike

V

VecLike
Returns
Vec

Dist()

static Dist(A: VecLike, B: VecLike): number
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
number

Dist2()

static Dist2(A: VecLike, B: VecLike): number
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
number

DistanceToLineSegment()

static DistanceToLineSegment(
  A: VecLike,
  B: VecLike,
  P: VecLike,
  clamp?: boolean
): number
Parameters
NameDescription

A

VecLike

B

VecLike

P

VecLike

clamp

boolean
Returns
number

DistanceToLineThroughPoint()

static DistanceToLineThroughPoint(A: VecLike, u: VecLike, P: VecLike): number
Parameters
NameDescription

A

VecLike

u

VecLike

P

VecLike
Returns
number

DistMin()

static DistMin(A: VecLike, B: VecLike, n: number): boolean
Parameters
NameDescription

A

VecLike

B

VecLike

n

number
Returns
boolean

Div()

static Div(A: VecLike, t: number): Vec
Parameters
NameDescription

A

VecLike

t

number
Returns
Vec

DivV()

static DivV(A: VecLike, B: VecLike): Vec
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
Vec

Dpr()

Dot product of two vectors which is used to calculate the angle between them.

static Dpr(A: VecLike, B: VecLike): number
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
number

Equals()

static Equals(A: VecLike, B: VecLike): boolean
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
boolean

EqualsXY()

static EqualsXY(A: VecLike, x: number, y: number): boolean
Parameters
NameDescription

A

VecLike

x

number

y

number
Returns
boolean

From()

static From({ x, y, z }: VecModel): Vec
Parameters
NameDescription

{ x, y, z }

VecModel
Returns
Vec

FromAngle()

static FromAngle(r: number, length?: number): Vec
Parameters
NameDescription

r

number

length

number
Returns
Vec

FromArray()

static FromArray(v: number[]): Vec
Parameters
NameDescription

v

number[]
Returns
Vec

IsNaN()

static IsNaN(A: VecLike): boolean
Parameters
NameDescription

A

VecLike
Returns
boolean

Len()

static Len(A: VecLike): number
Parameters
NameDescription

A

VecLike
Returns
number

Len2()

static Len2(A: VecLike): number
Parameters
NameDescription

A

VecLike
Returns
number

Lrp()

Linearly interpolate between two points.

static Lrp(A: VecLike, B: VecLike, t: number): Vec
Parameters
NameDescription

A

VecLike

The first point.

B

VecLike

The second point.

t

number

The interpolation value between 0 and 1.

Returns
Vec

The interpolated point.


Max()

static Max(A: VecLike, B: VecLike): Vec
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
Vec

Med()

static Med(A: VecLike, B: VecLike): Vec
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
Vec

Min()

static Min(A: VecLike, B: VecLike): Vec
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
Vec

Mul()

static Mul(A: VecLike, t: number): Vec
Parameters
NameDescription

A

VecLike

t

number
Returns
Vec

MulV()

static MulV(A: VecLike, B: VecLike): Vec
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
Vec

NearestPointOnLineSegment()

static NearestPointOnLineSegment(
  A: VecLike,
  B: VecLike,
  P: VecLike,
  clamp?: boolean
): Vec
Parameters
NameDescription

A

VecLike

B

VecLike

P

VecLike

clamp

boolean
Returns
Vec

NearestPointOnLineThroughPoint()

Get the nearest point on a line with a known unit vector that passes through point A

Vec.nearestPointOnLineThroughPoint(A, u, Point)
static NearestPointOnLineThroughPoint(A: VecLike, u: VecLike, P: VecLike): Vec
Parameters
NameDescription

A

VecLike

Any point on the line

u

VecLike

The unit vector for the line.

P

VecLike

A point not on the line to test.

Returns
Vec

Neg()

static Neg(A: VecLike): Vec
Parameters
NameDescription

A

VecLike
Returns
Vec

Nudge()

static Nudge(A: VecLike, B: VecLike, distance: number): Vec
Parameters
NameDescription

A

VecLike

B

VecLike

distance

number
Returns
Vec

Per()

Get the perpendicular vector to A.

static Per(A: VecLike): Vec
Parameters
NameDescription

A

VecLike
Returns
Vec

PointsBetween()

Get an array of points (with simulated pressure) between two points.

static PointsBetween(A: VecModel, B: VecModel, steps?: number): Vec[]
Parameters
NameDescription

A

VecModel

The first point.

B

VecModel

The second point.

steps

number

The number of points to return.

Returns
Vec[]

Pry()

Get the projection of A onto B.

static Pry(A: VecLike, B: VecLike): number
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
number

Rescale()

static Rescale(A: VecLike, n: number): Vec
Parameters
NameDescription

A

VecLike

n

number
Returns
Vec

Rot()

static Rot(A: VecLike, r?: number): Vec
Parameters
NameDescription

A

VecLike

r

number
Returns
Vec

RotWith()

static RotWith(A: VecLike, C: VecLike, r: number): Vec
Parameters
NameDescription

A

VecLike

C

VecLike

r

number
Returns
Vec

ScaleWithOrigin()

static ScaleWithOrigin(A: VecLike, scale: number, origin: VecLike): Vec
Parameters
NameDescription

A

VecLike

scale

number

origin

VecLike
Returns
Vec

Slope()

static Slope(A: VecLike, B: VecLike): number
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
number

Snap()

static Snap(A: VecLike, step?: number): Vec
Parameters
NameDescription

A

VecLike

step

number
Returns
Vec

SnapToGrid()

static SnapToGrid(A: VecLike, gridSize?: number): Vec
Parameters
NameDescription

A

VecLike

gridSize

number
Returns
Vec

Sub()

static Sub(A: VecLike, B: VecLike): Vec
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
Vec

SubScalar()

static SubScalar(A: VecLike, n: number): Vec
Parameters
NameDescription

A

VecLike

n

number
Returns
Vec

SubXY()

static SubXY(A: VecLike, x: number, y: number): Vec
Parameters
NameDescription

A

VecLike

x

number

y

number
Returns
Vec

Tan()

static Tan(A: VecLike, B: VecLike): Vec
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
Vec

ToAngle()

static ToAngle(A: VecLike): number
Parameters
NameDescription

A

VecLike
Returns
number

ToArray()

static ToArray(A: VecLike): number[]
Parameters
NameDescription

A

VecLike
Returns
number[]

ToCss()

static ToCss(A: VecLike): string
Parameters
NameDescription

A

VecLike
Returns
string

ToFixed()

static ToFixed(A: VecLike): Vec
Parameters
NameDescription

A

VecLike
Returns
Vec

ToInt()

static ToInt(A: VecLike): Vec
Parameters
NameDescription

A

VecLike
Returns
Vec

ToJson()

static ToJson(A: VecLike): {
  x: number
  y: number
  z: number | undefined
}
Parameters
NameDescription

A

VecLike
Returns
{
  x: number
  y: number
  z: number | undefined
}

ToString()

static ToString(A: VecLike): string
Parameters
NameDescription

A

VecLike
Returns
string

Uni()

Get the unit vector of A.

static Uni(A: VecLike): Vec
Parameters
NameDescription

A

VecLike
Returns
Vec

abs()

abs(): this

add()

add(V: VecLike): this
Parameters
NameDescription

V

VecLike
Returns
this

addScalar()

addScalar(n: number): this
Parameters
NameDescription

n

number
Returns
this

addXY()

addXY(x: number, y: number): this
Parameters
NameDescription

x

number

y

number
Returns
this

angle()

angle(B: VecLike): number
Parameters
NameDescription

B

VecLike
Returns
number

clamp()

clamp(min: number, max?: number): this
Parameters
NameDescription

min

number

max

number
Returns
this

clone()

clone(): Vec

cpr()

cpr(V: VecLike): number
Parameters
NameDescription

V

VecLike
Returns
number

cross()

cross(V: VecLike): this
Parameters
NameDescription

V

VecLike
Returns
this

dist()

dist(V: VecLike): number
Parameters
NameDescription

V

VecLike
Returns
number

distanceToLineSegment()

distanceToLineSegment(A: VecLike, B: VecLike): number
Parameters
NameDescription

A

VecLike

B

VecLike
Returns
number

div()

div(t: number): this
Parameters
NameDescription

t

number
Returns
this

divV()

divV(V: VecLike): this
Parameters
NameDescription

V

VecLike
Returns
this

dpr()

dpr(V: VecLike): number
Parameters
NameDescription

V

VecLike
Returns
number

equals()

equals(B: VecLike): boolean
Parameters
NameDescription

B

VecLike
Returns
boolean

equalsXY()

equalsXY(x: number, y: number): boolean
Parameters
NameDescription

x

number

y

number
Returns
boolean

len()

len(): number

len2()

len2(): number

lrp()

lrp(B: VecLike, t: number): Vec
Parameters
NameDescription

B

VecLike

t

number
Returns
Vec

mul()

mul(t: number): this
Parameters
NameDescription

t

number
Returns
this

mulV()

mulV(V: VecLike): this
Parameters
NameDescription

V

VecLike
Returns
this

neg()

neg(): this

norm()

norm(): this

nudge()

nudge(B: VecLike, distance: number): this
Parameters
NameDescription

B

VecLike

distance

number
Returns
this

per()

per(): this

pry()

pry(V: VecLike): number
Parameters
NameDescription

V

VecLike
Returns
number

rot()

rot(r: number): this
Parameters
NameDescription

r

number
Returns
this

rotWith()

rotWith(C: VecLike, r: number): this
Parameters
NameDescription

C

VecLike

r

number
Returns
this

set()

set(x?: number, y?: number, z?: number): this
Parameters
NameDescription

x

number

y

number

z

number
Returns
this

setTo()

setTo({ x, y, z }: VecLike): this
Parameters
NameDescription

{ x, y, z }

VecLike
Returns
this

slope()

slope(B: VecLike): number
Parameters
NameDescription

B

VecLike
Returns
number

snapToGrid()

snapToGrid(gridSize: number): this
Parameters
NameDescription

gridSize

number
Returns
this

sub()

sub(V: VecLike): this
Parameters
NameDescription

V

VecLike
Returns
this

subScalar()

subScalar(n: number): this
Parameters
NameDescription

n

number
Returns
this

subXY()

subXY(x: number, y: number): this
Parameters
NameDescription

x

number

y

number
Returns
this

tan()

tan(V: VecLike): Vec
Parameters
NameDescription

V

VecLike
Returns
Vec

toAngle()

toAngle(): number

toArray()

toArray(): number[]

toFixed()

toFixed(): Vec

toJson()

toJson(): VecModel

toString()

toString(): string

uni()

uni(): Vec

UserPreferencesManagerRecordType