For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /math/classes/VectorXZUtils.md.

Class: VectorXZUtils

对 VectorXZ 对象执行操作的实用工具类。所有方法均为静态方法,且不会修改输入对象。

Utilities operating on VectorXZ objects. All methods are static and do not modify the input objects.

Constructors

Constructor

new VectorXZUtils(): VectorXZUtils

Returns

VectorXZUtils

Methods

add()

static add(v1, v2): VectorXZ

add

将两个向量相加,生成一个新向量。

Add two vectors to produce a new vector

Parameters

v1

VectorXZ

v2

VectorXZ

Returns

VectorXZ


clamp()

static clamp(v, limits?): VectorXZ

clamp

将向量的各个分量限制在给定范围内,生成一个新向量。

Clamps the components of a vector to limits to produce a new vector

Parameters

v

VectorXZ

limits?
max?

any

min?

any

Returns

VectorXZ


distance()

static distance(a, b): number

distance

计算两个向量之间的距离。

Calculate the distance between two vectors

Parameters

a

VectorXZ

b

VectorXZ

Returns

number


dot()

static dot(a, b): number

dot

计算两个向量的点积。

Calculate the dot product of two vectors

Parameters

a

VectorXZ

b

VectorXZ

Returns

number


equals()

static equals(v1, v2): boolean

equals

检查两个向量是否相等。

Check the equality of two vectors

Parameters

v1

VectorXZ

v2

VectorXZ

Returns

boolean


floor()

static floor(v): VectorXZ

floor

对向量的各个分量向下取整,生成一个新向量。

Floor the components of a vector to produce a new vector

Parameters

v

VectorXZ

Returns

VectorXZ


fromString()

static fromString(str, delimiter?): any

fromString

VectorXZUtils.toString 生成的字符串表示形式中获取 VectorXZ。如果任何数值不是数字,或格式无效,则返回 undefined。

Gets a VectorXZ from the string representation produced by VectorXZUtils.toString. If any numeric value is not a number or the format is invalid, undefined is returned.

Parameters

str

string

要解析的字符串。

The string to parse

delimiter?

string

用于分隔各分量的分隔符。默认为 VectorXZUtils.toString 的默认值。

The delimiter used to separate the components. Defaults to the same as the default for VectorXZUtils.toString

Returns

any


lerp()

static lerp(a, b, t): VectorXZ

lerp

使用两个向量之间各分量的线性插值构造一个新向量。

Constructs a new vector using linear interpolation on each component from two vectors.

Parameters

a

VectorXZ

b

VectorXZ

t

number

Returns

VectorXZ


magnitude()

static magnitude(v): number

magnitude

向量的模长。

The magnitude of a vector

Parameters

v

VectorXZ

Returns

number


multiply()

static multiply(a, b): VectorXZ

multiply

两个向量按元素相乘。 不要与 VectorXZUtils.dot 乘积混淆。

Element-wise multiplication of two vectors together. Not to be confused with VectorXZUtils.dot product

Parameters

a

VectorXZ

b

VectorXZ

Returns

VectorXZ


normalize()

static normalize(v): VectorXZ

normalize

将向量归一化为单位向量。

Takes a vector 3 and normalizes it to a unit vector

Parameters

v

VectorXZ

Returns

VectorXZ


scale()

static scale(v1, scale): VectorXZ

scale

将向量的所有分量乘以一个标量,生成一个新向量。

Multiple all entries in a vector by a single scalar value producing a new vector

Parameters

v1

VectorXZ

scale

number

Returns

VectorXZ


slerp()

static slerp(a, b, t): VectorXZ

slerp

使用两个向量之间各分量的球面线性插值构造一个新向量。

Constructs a new vector using spherical linear interpolation on each component from two vectors.

Parameters

a

VectorXZ

b

VectorXZ

t

number

Returns

VectorXZ


subtract()

static subtract(v1, v2): VectorXZ

subtract

将第二个向量从第一个向量中减去,生成一个新向量(v1-v2)。

Subtract two vectors to produce a new vector (v1-v2)

Parameters

v1

VectorXZ

v2

VectorXZ

Returns

VectorXZ


toString()

static toString(v, options?): string

toString

创建向量的字符串表示形式。

Create a string representation of a vectorxz

Parameters

v

VectorXZ

options?
decimals?

number

delimiter?

string

Returns

string