Skip to content

@jtopo/core / vec2

Class: vec2

二维向量计算

Table of contents

Constructors

Properties

Constructors

constructor

new vec2()

Properties

add

Static add: (out: Vec2Type, v1: Vec2Type, v2: Vec2Type) => Vec2Type = add

Type declaration

(out, v1, v2): Vec2Type

Parameters
NameType
outVec2Type
v1Vec2Type
v2Vec2Type
Returns

Vec2Type


dot

Static dot: (v1: Vec2Type, v2: Vec2Type) => number = dot

Type declaration

(v1, v2): number

Parameters
NameType
v1Vec2Type
v2Vec2Type
Returns

number


len

Static len: (v: Vec2Type) => number = len

Type declaration

(v): number

Parameters
NameType
vVec2Type
Returns

number


multiplyC

Static multiplyC: (out: Vec2Type, v1: Vec2Type, c: number) => Vec2Type = multiplyC

Type declaration

(out, v1, c): Vec2Type

Parameters
NameType
outVec2Type
v1Vec2Type
cnumber
Returns

Vec2Type


negate

Static negate: (out: Vec2Type, a: Vec2Type) => Vec2Type = negate

Type declaration

(out, a): Vec2Type

Parameters
NameType
outVec2Type
aVec2Type
Returns

Vec2Type


normalize

Static normalize: (out: Vec2Type, v: Vec2Type) => Vec2Type = normalize

Type declaration

(out, v): Vec2Type

Parameters
NameType
outVec2Type
vVec2Type
Returns

Vec2Type


projection

Static projection: (out: Vec2Type, v: Vec2Type, n: Vec2Type) => Vec2Type = projection

Type declaration

(out, v, n): Vec2Type

Parameters
NameType
outVec2Type
vVec2Type
nVec2Type
Returns

Vec2Type


scale

Static scale: (out: Vec2Type, v: Vec2Type, s: number) => Vec2Type = scale

Type declaration

(out, v, s): Vec2Type

Parameters
NameType
outVec2Type
vVec2Type
snumber
Returns

Vec2Type