Class: VectorXZBuilder
VectorXZ 包装类,可在需要 VectorXZ 的 @minecraft/server API 中用作 VectorXZ。
VectorXZ wrapper class which can be used as a VectorXZ for APIs on @minecraft/server which require a VectorXZ.
Implements
unknown
Constructors
Constructor
new VectorXZBuilder(
vecStr,delim?):VectorXZBuilder
Parameters
vecStr
string
delim?
string
Returns
VectorXZBuilder
Constructor
new VectorXZBuilder(
vec,arg?):VectorXZBuilder
Parameters
vec
VectorXZ
arg?
undefined
Returns
VectorXZBuilder
Constructor
new VectorXZBuilder(
x,y):VectorXZBuilder
Parameters
x
number
y
number
Returns
VectorXZBuilder
Properties
x
x:
number
z
z:
number
Methods
add()
add(
v):this
add
将向量 v 与当前向量相加,并返回自身。
Adds the vector v to this, returning itself.
Parameters
v
VectorXZ
Returns
this
assign()
assign(
vec):this
将传入向量的值赋给当前向量,并返回自身。
Assigns the values of the passed in vector to this vector. Returns itself.
Parameters
vec
VectorXZ
Returns
this
clamp()
clamp(
limits):this
clamp
将当前向量的各分量限制在给定范围内,并返回自身。
Clamps the components of a vector to limits to produce a new vector
Parameters
limits
max?
any
min?
any
Returns
this
distance()
distance(
vec):number
distance
计算两个向量之间的距离。
Calculate the distance between two vectors
Parameters
vec
VectorXZ
Returns
number
dot()
dot(
vec):number
dot
计算当前向量与传入向量的点积。
Computes the dot product of this and the passed in vector.
Parameters
vec
VectorXZ
Returns
number
equals()
equals(
v):boolean
equals
检查两个向量是否相等。
Check the equality of two vectors
Parameters
v
VectorXZ
Returns
boolean
floor()
floor():
this
floor
对向量的各个分量向下取整,并返回自身。
Floor the components of a vector to produce a new vector
Returns
this
lerp()
lerp(
vec,t):this
lerp
使用两个向量之间各分量的线性插值构造一个新向量,并返回自身。
Constructs a new vector using linear interpolation on each component from two vectors.
Parameters
vec
VectorXZ
t
number
Returns
this
magnitude()
magnitude():
number
magnitude
向量的模长。
The magnitude of the vector
Returns
number
multiply()
multiply(
vec):this
multiply
当前向量与传入向量按元素相乘,并返回自身。 不要与 VectorXZBuilder.dot 乘积混淆。
Element-wise multiplication of two vectors together. Not to be confused with VectorXZBuilder.dot product
Parameters
vec
VectorXZ
Returns
this
normalize()
normalize():
this
normalize
将当前向量归一化,并返回自身。
Normalizes this vector, returning itself.
Returns
this
scale()
scale(
val):this
scale
将当前向量按传入的标量进行缩放,并返回自身。
Scales this by the passed in value, returning itself.
Parameters
val
number
Returns
this
slerp()
slerp(
vec,t):this
slerp
使用两个向量之间各分量的球面线性插值构造一个新向量,并返回自身。
Constructs a new vector using spherical linear interpolation on each component from two vectors.
Parameters
vec
VectorXZ
t
number
Returns
this
subtract()
subtract(
v):this
subtract
从当前向量中减去向量 v,并返回自身。
Subtracts the vector v from this, returning itself.
Parameters
v
VectorXZ
Returns
this
toString()
toString(
options?):string
Parameters
options?
decimals?
number
delimiter?
string
Returns
string
