Skip to content

Class: Vector3Ex

extra function of vector3

Constructors

Methods

Constructors

constructor

new Vector3Ex(): Vector3Ex

Returns

Vector3Ex

Methods

add

add(v1, v2, target?): Vector3

vector3 add

Parameters

NameType
v1Vector3
v2Vector3
target?Vector3

Returns

Vector3

Defined in

src/util/Vector3Ex.ts:15


sub

sub(v1, v2, target?): Vector3

vector3 sub

Parameters

NameType
v1Vector3
v2Vector3
target?Vector3

Returns

Vector3

Defined in

src/util/Vector3Ex.ts:32


mul

mul(v1, v2, target?): Vector3

vector3 mul

Parameters

NameType
v1Vector3
v2Vector3
target?Vector3

Returns

Vector3

Defined in

src/util/Vector3Ex.ts:49


mulScale

mulScale(v1, v, target?): Vector3

vector3 mul

Parameters

NameType
v1Vector3
vnumber
target?Vector3

Returns

Vector3

Defined in

src/util/Vector3Ex.ts:66


div

div(v1, v2, target?): Vector3

vector3 div

Parameters

NameType
v1Vector3
v2Vector3
target?Vector3

Returns

Vector3

Defined in

src/util/Vector3Ex.ts:83


normalize

normalize(v1): Vector3

normalize

Parameters

NameTypeDescription
v1Vector3source vector

Returns

Vector3

result vector

Defined in

src/util/Vector3Ex.ts:98


dot

dot(v1, v2): number

dot

Parameters

NameTypeDescription
v1Vector3first vector
v2Vector3second vector

Returns

number

result

Defined in

src/util/Vector3Ex.ts:109


calculateVectorAngle_xz

calculateVectorAngle_xz(v1, v2): number

Calculate the angle between two vectors

Parameters

NameTypeDescription
v1Vector3first vector
v2Vector3second vector

Returns

number

Angle result in radians

Defined in

src/util/Vector3Ex.ts:121


distance

distance(v1, v2): number

Calculate the distance between two points

Parameters

NameTypeDescription
v1Vector3first vector
v2Vector3second vector

Returns

number

distance

Static

Defined in

src/util/Vector3Ex.ts:135


getRandomXYZ

getRandomXYZ(min?, max?): Vector3

make a Random 3D Vector

Parameters

NameTypeDefault valueDescription
minnumber-100The min random value of vector components
maxnumber100The max random value of vector components

Returns

Vector3

random vector

Defined in

src/util/Vector3Ex.ts:145


getRandomV3

getRandomV3(min?, max?, yMin, yMax): Vector3

make a Random 3D Vector

Parameters

NameTypeDefault valueDescription
minnumber-100The min random value of vector component-x
maxnumber100The max random value of vector component-x
yMinnumberundefinedThe min random value of vector component-y
yMaxnumberundefinedThe max random value of vector component-y

Returns

Vector3

random vector

Defined in

src/util/Vector3Ex.ts:157


sphere

sphere(radius): Vector3

Parameters

NameType
radiusnumber

Returns

Vector3

Defined in

src/util/Vector3Ex.ts:161


sphereXYZ

sphereXYZ(radiusMin, radiusMax, x?, y?, z?): Vector3

Parameters

NameTypeDefault value
radiusMinnumberundefined
radiusMaxnumberundefined
xnumber1
ynumber1
znumber1

Returns

Vector3

Defined in

src/util/Vector3Ex.ts:169