# MCVector3d

A 3-dimensional vector, in a 3-dimensional vector space.

This class is immutable, meaning its values cannot change, so it is safe to be stored as a key in maps or in collections.

No, it's not an arrow.

## 导入相关包

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

`ZenScript Copy`import crafttweaker.api.util.MCVector3d;``

## Constructor #构造函数

`ZenScript Copy`new MCVector3d(x as double, y as double, z as double) as MCVector3d``

xdoubleNo description provided
ydoubleNo description provided
zdoubleNo description provided

## 方法

cross

Performs the cross product between this vector and `other`.

Return Type: MCVector3d

`ZenScript Copy`MCVector3d.cross(other as MCVector3d) as MCVector3d``

otherMCVector3dThe other vector.
distanceTo

Computes the Euclidean distance between this vector and the other vector.

Return Type: double

`ZenScript Copy`MCVector3d.distanceTo(other as MCVector3d) as double``

otherMCVector3dThe other vector.
dot

Performs a dot product between this vector and `other`.

Return Type: double

`ZenScript Copy`MCVector3d.dot(other as MCVector3d) as double``

otherMCVector3dThe other vector.
getCoordinate

Gets the coordinate of this vector that corresponds to the given DirectionAxis.

Return Type: double

`ZenScript Copy`MCVector3d.getCoordinate(axis as DirectionAxis) as double``

axisDirectionAxisThe axis.
getCoordinate

Gets the coordinate of this vector identified by the specified index.

Namely, 0 corresponds to the X coordinate, 1 to Y, and 2 to Z.

Return Type: double

`ZenScript Copy`MCVector3d.getCoordinate(index as int) as double``

indexintThe coordinate index.
minus

Subtracts `other` from this vector.

Return Type: MCVector3d

`ZenScript Copy`MCVector3d.minus(other as MCVector3d) as MCVector3d``

otherMCVector3dThe other vector.
minus

Subtracts the vector `(x, y, z)` from this vector.

Return Type: MCVector3d

`ZenScript Copy`MCVector3d.minus(x as double, y as double, z as double) as MCVector3d``

xdoubleThe x component of the other vector.
ydoubleThe y component of the other vector.
zdoubleThe z component of the other vector.
normalize

Normalizes the current vector, making it of unit length.

Return Type: MCVector3d

```ZenScript Copy```MCVector3d.normalize() as MCVector3d
myMCVector3d.normalize();``````
plus

Adds this vector to the `other` vector, computing their sum member by member.

Return Type: MCVector3d

`ZenScript Copy`MCVector3d.plus(other as MCVector3d) as MCVector3d``

otherMCVector3dThe other vector.
plus

Adds this vector to the vector `(x, y, z)`, computing their sum member by member.

Return Type: MCVector3d

`ZenScript Copy`MCVector3d.plus(x as double, y as double, z as double) as MCVector3d``

xdoubleThe x component of the other vector.
ydoubleThe y component of the other vector.
zdoubleThe z component of the other vector.
scale

Scales the current vector by the given `factor`.

Return Type: MCVector3d

`ZenScript Copy`MCVector3d.scale(factor as double) as MCVector3d``

factordoubleThe factor.
squareDistanceTo

Computes the squared Euclidean distance between this vector and the other vector.

This method is faster and less error-prone than calling `distanceTo` and squaring the result.

Return Type: double

`ZenScript Copy`MCVector3d.squareDistanceTo(other as MCVector3d) as double``

otherMCVector3dThe other vector.
subtractReverse

Subtracts this vector from the `other` vector and returns the result.

Return Type: MCVector3d

`ZenScript Copy`MCVector3d.subtractReverse(other as MCVector3d) as MCVector3d``

otherMCVector3dThe vector from which this vector should be subtracted from.
times

Multiplies the two vectors member by member, computing what is known as the Hadamard product.

Return Type: MCVector3d

`ZenScript Copy`MCVector3d.times(other as MCVector3d) as MCVector3d``

otherMCVector3dThe other vector.
times

Multiplies this vector with the vector `(x, y, z)`, computing what is known as the Hadamard product.

Return Type: MCVector3d

`ZenScript Copy`MCVector3d.times(x as double, y as double, z as double) as MCVector3d``

xdoubleThe x component of the other vector.
ydoubleThe y component of the other vector.
zdoubleThe z component of the other vector.

## 参数

inverseMCVector3dtruefalse
magnitudedoubletruefalse
magnitudeSquareddoubletruefalse
xdoubletruefalse
ydoubletruefalse
zdoubletruefalse