Table of contents
class Vec {}

Constructor

Constructs a new instance of the Vec class

Parameters

NameDescription

x

number

y

number

z

number

Properties

pressure

readonly
get pressure(): number

x

x: number

y

y: number

z

z: number

Methods

Abs()

static
static Abs(A: VecLike): Vec

Parameters

NameDescription

A

Returns


Add()

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

Parameters

NameDescription

A

B

Returns


AddScalar()

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

Parameters

NameDescription

A

n

number

Returns


AddXY()

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

Parameters

NameDescription

A

x

number

y

number

Returns


Angle()

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

Parameters

NameDescription

A

B

Returns

number

Average()

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

Parameters

NameDescription

arr

Returns


Cast()

static
static Cast(A: VecLike): Vec

Parameters

NameDescription

A

Returns


Clamp()

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

Parameters

NameDescription

A

min

number

max

number

Returns


Clockwise()

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

Parameters

NameDescription

A

B

C

Returns

boolean

Cpr()

static

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

B

Returns

number

Cross()

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

Parameters

NameDescription

A

V

Returns


Dist()

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

Parameters

NameDescription

A

B

Returns

number

Dist2()

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

Parameters

NameDescription

A

B

Returns

number

DistanceToLineSegment()

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

Parameters

NameDescription

A

B

P

clamp

boolean

Returns

number

DistanceToLineThroughPoint()

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

Parameters

NameDescription

A

u

P

Returns

number

DistMin()

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

Parameters

NameDescription

A

B

n

number

Returns

boolean

Div()

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

Parameters

NameDescription

A

t

number

Returns


DivV()

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

Parameters

NameDescription

A

B

Returns


Dpr()

static

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

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

Parameters

NameDescription

A

B

Returns

number

Equals()

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

Parameters

NameDescription

A

B

Returns

boolean

EqualsXY()

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

Parameters

NameDescription

A

x

number

y

number

Returns

boolean

From()

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

Parameters

NameDescription

{ x, y, z }

Returns


FromAngle()

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

Parameters

NameDescription

r

number

length

number

Returns


FromArray()

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

Parameters

NameDescription

v

number[]

Returns


IsNaN()

static
static IsNaN(A: VecLike): boolean

Parameters

NameDescription

A

Returns

boolean

Len()

static
static Len(A: VecLike): number

Parameters

NameDescription

A

Returns

number

Len2()

static
static Len2(A: VecLike): number

Parameters

NameDescription

A

Returns

number

Lrp()

static

Linearly interpolate between two points.

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

Parameters

NameDescription

A

The first point.

B

The second point.

t

number

The interpolation value between 0 and 1.

Returns

The interpolated point.


Max()

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

Parameters

NameDescription

A

B

Returns


Med()

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

Parameters

NameDescription

A

B

Returns


Min()

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

Parameters

NameDescription

A

B

Returns


Mul()

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

Parameters

NameDescription

A

t

number

Returns


MulV()

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

Parameters

NameDescription

A

B

Returns


NearestPointOnLineSegment()

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

Parameters

NameDescription

A

B

P

clamp

boolean

Returns


NearestPointOnLineThroughPoint()

static

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

Any point on the line

u

The unit vector for the line.

P

A point not on the line to test.

Returns


Neg()

static
static Neg(A: VecLike): Vec

Parameters

NameDescription

A

Returns


Nudge()

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

Parameters

NameDescription

A

B

distance

number

Returns


Per()

static

Get the perpendicular vector to A.

static Per(A: VecLike): Vec

Parameters

NameDescription

A

Returns


PointsBetween()

static

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

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

Parameters

NameDescription

A

The first point.

B

The second point.

steps

number

The number of points to return.

Returns

Vec[]

Pry()

static

Get the projection of A onto B.

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

Parameters

NameDescription

A

B

Returns

number

Rescale()

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

Parameters

NameDescription

A

n

number

Returns


Rot()

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

Parameters

NameDescription

A

r

number

Returns


RotWith()

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

Parameters

NameDescription

A

C

r

number

Returns


ScaleWithOrigin()

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

Parameters

NameDescription

A

scale

number

origin

Returns


Slope()

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

Parameters

NameDescription

A

B

Returns

number

Snap()

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

Parameters

NameDescription

A

step

number

Returns


SnapToGrid()

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

Parameters

NameDescription

A

gridSize

number

Returns


Sub()

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

Parameters

NameDescription

A

B

Returns


SubScalar()

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

Parameters

NameDescription

A

n

number

Returns


SubXY()

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

Parameters

NameDescription

A

x

number

y

number

Returns


Tan()

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

Parameters

NameDescription

A

B

Returns


ToAngle()

static
static ToAngle(A: VecLike): number

Parameters

NameDescription

A

Returns

number

ToArray()

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

Parameters

NameDescription

A

Returns

number[]

ToCss()

static
static ToCss(A: VecLike): string

Parameters

NameDescription

A

Returns

string

ToFixed()

static
static ToFixed(A: VecLike): Vec

Parameters

NameDescription

A

Returns


ToInt()

static
static ToInt(A: VecLike): Vec

Parameters

NameDescription

A

Returns


ToJson()

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

Parameters

NameDescription

A

Returns

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

ToString()

static
static ToString(A: VecLike): string

Parameters

NameDescription

A

Returns

string

Uni()

static

Get the unit vector of A.

static Uni(A: VecLike): Vec

Parameters

NameDescription

A

Returns


abs()

abs(): this

add()

add(V: VecLike): this

Parameters

NameDescription

V

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

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

Returns

number

cross()

cross(V: VecLike): this

Parameters

NameDescription

V

Returns

this

dist()

dist(V: VecLike): number

Parameters

NameDescription

V

Returns

number

distanceToLineSegment()

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

Parameters

NameDescription

A

B

Returns

number

div()

div(t: number): this

Parameters

NameDescription

t

number

Returns

this

divV()

divV(V: VecLike): this

Parameters

NameDescription

V

Returns

this

dpr()

dpr(V: VecLike): number

Parameters

NameDescription

V

Returns

number

equals()

equals(B: VecLike): boolean

Parameters

NameDescription

B

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

t

number

Returns


mul()

mul(t: number): this

Parameters

NameDescription

t

number

Returns

this

mulV()

mulV(V: VecLike): this

Parameters

NameDescription

V

Returns

this

neg()

neg(): this

norm()

norm(): this

nudge()

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

Parameters

NameDescription

B

distance

number

Returns

this

per()

per(): this

pry()

pry(V: VecLike): number

Parameters

NameDescription

V

Returns

number

rot()

rot(r: number): this

Parameters

NameDescription

r

number

Returns

this

rotWith()

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

Parameters

NameDescription

C

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 }

Returns

this

slope()

slope(B: VecLike): number

Parameters

NameDescription

B

Returns

number

snapToGrid()

snapToGrid(gridSize: number): this

Parameters

NameDescription

gridSize

number

Returns

this

sub()

sub(V: VecLike): this

Parameters

NameDescription

V

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

Returns


toAngle()

toAngle(): number

toArray()

toArray(): number[]

toFixed()

toFixed(): Vec

toJson()

toJson(): VecModel

toString()

toString(): string

uni()

uni(): Vec

Prev
UserPreferencesManager
Next
RecordType