The Vector3 class is used to create three-dimensional vectors.

Vector3 类用于创建三维向量。

实现

  • IClone

构造函数

  • 参数

    • x: number = 0

      X-axis coordinate.

    • y: number = 0

      Y-axis coordinate.

    • z: number = 0

      Z-axis coordinate.

    返回 Vector3

    Constructor method, 3D vector initialization.

    构造方法,初始化三维向量。

属性

x: number

X-axis coordinate

X轴坐标

y: number

Y-axis coordinate

Y轴坐标

z: number

Z-axis coordinate

Z轴坐标

ForwardLH: Readonly<Vector3> = ...

Forward vector in left-handed coordinate system (0, 0, 1).

左手坐标系中的前向量 (0, 0, 1)。

ForwardRH: Readonly<Vector3> = ...

Forward vector in right-handed coordinate system (0, 0, -1).

右手坐标系中的前向量 (0, 0, -1)。

NegativeUnitX: Readonly<Vector3> = ...

Negative X axis (-1, 0, 0).

负X轴 (-1, 0, 0)。

ONE: Readonly<Vector3> = ...

One vector (1, 1, 1).

单位向量 (1, 1, 1)。

TEMP: Vector3 = ...

Temporary vector.

临时向量。

UnitX: Readonly<Vector3> = ...

Positive X axis (1, 0, 0).

正X轴 (1, 0, 0)。

UnitY: Readonly<Vector3> = ...

Positive Y axis (0, 1, 0).

正Y轴 (0, 1, 0)。

UnitZ: Readonly<Vector3> = ...

Positive Z axis (0, 0, 1).

正Z轴 (0, 0, 1)。

Up: Readonly<Vector3> = ...

Up vector (0, 1, 0).

上向量 (0, 1, 0)。

ZERO: Readonly<Vector3> = ...

Zero vector (0, 0, 0).

零向量 (0, 0, 0)。

方法

  • 参数

    • b: Vector3

      The vector to dot product with.

    返回 number

    The dot product.

    Calculates the dot product of this vector with another vector.

    计算向量点乘。

  • 参数

    • value: Vector3

      The vector to compare with.

    返回 boolean

    Returns true if the vectors are equal, false otherwise.

    Determines whether the three-dimensional vector is equal to another vector.

    判断三维向量是否与另一个向量相等。

  • 参数

    • arr: ArrayLike<number>

      The source array.

    • offset: number = 0

      The offset in the array. Default is 0.

    返回 void

    Copies values from an array.

    从数组中拷贝值。

  • 参数

    • arr: {
          [n: number]: number;
      }

      The target array.

      • [n: number]: number
    • offset: number = 0

      The offset in the array. Default is 0.

    返回 void

    Writes the vector values to an array.

    将向量值写入数组。

  • 参数

    • value: Vector3

      The vector to be clamped.

    • min: Vector3

      The minimum values for each component.

    • max: Vector3

      The maximum values for each component.

    • out: Vector3

      The output clamped vector.

    返回 void

    Clamps a vector within a specified range.

    将向量限制在指定范围内。

  • 参数

    返回 number

    The distance.

    Calculates the distance between two three-dimensional vectors.

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

  • 参数

    返回 number

    The squared distance.

    Calculates the squared distance between two three-dimensional vectors.

    计算两个三维向量之间距离的平方。

  • 参数

    返回 number

    The dot product.

    Calculates the dot product of two three-dimensional vectors.

    计算两个三维向量的点积。

  • 参数

    返回 boolean

    Whether the vectors are equal.

    Determines whether two three-dimensional vectors are equal.

    判断两个三维向量是否相等。

  • 参数

    • a: Vector3

      The starting vector.

    • b: Vector3

      The ending vector.

    • t: number

      The interpolation coefficient in the range [0, 1].

    • out: Vector3

      The output interpolated vector.

    返回 void

    Performs a linear interpolation between two three-dimensional vectors.

    在两个三维向量之间进行线性插值。

  • 参数

    返回 void

    Calculates a new three-dimensional vector by taking the maximum of x, y, and z from two vectors.

    通过取两个三维向量的 x、y、z 的最大值计算新的三维向量。

  • 参数

    返回 void

    Calculates a new three-dimensional vector by taking the minimum of x, y, and z from two vectors.

    通过取两个三维向量的 x、y、z 的最小值计算新的三维向量。

  • 参数

    • a: Vector3

      The source three-dimensional vector.

    返回 number

    The squared scalar length.

    Calculates the squared scalar length of a vector.

    计算标量长度的平方。

  • 参数

    • a: Vector3

      The source vector3 to be scaled.

    • b: number

      The scaling factor.

    • out: Vector3

      The output scaled vector3.

    返回 void

    Scales a three-dimensional vector.

    缩放三维向量。

  • 参数

    • coordinate: Vector3

      The source three-dimensional vector.

    • transform: Matrix4x4

      The transformation matrix.

    • result: Vector3

      The output normalized three-dimensional vector.

    返回 void

    Transforms a three-dimensional vector to another normalized three-dimensional vector using a matrix.

    使用矩阵将三维向量转换为另一个归一化的三维向量。

  • 参数

    • normal: Vector3

      The source normal vector3.

    • transform: Matrix4x4

      The normal transformation matrix.

    • result: Vector3

      The output transformed normal vector3.

    返回 void

    Transforms a normal three-dimensional vector to another three-dimensional vector using a normal transformation matrix.

    使用法线变换矩阵将法线三维向量转换为另一个三维向量。

  • 参数

    • source: Vector3

      The source vector3 to be rotated.

    • rotation: Quaternion

      The rotation quaternion.

    • out: Vector3

      The output vector3.

    返回 void

    Rotates a three-dimensional vector by a quaternion.

    根据四元数旋转三维向量。

  • 参数

    • vector: Vector3

      The source vector3.

    • transform: Matrix4x4

      The transformation matrix.

    • result: Vector3

      The output transformed vector3.

    返回 void

    Transforms a three-dimensional vector to another three-dimensional vector using a matrix.

    使用矩阵将一个三维向量转换为另一个三维向量。

  • 参数

    • vector: Vector3

      The source vector3.

    • transform: Matrix4x4

      The transformation matrix.

    • result: Vector4

      The output vector4.

    返回 void

    Transforms a three-dimensional vector to a four-dimensional vector using a matrix.

    使用矩阵将三维向量转换为四维向量。