Options
All
  • Public
  • Public/Protected
  • All
Menu

表示三维的一个向量

Class representing a vector containing 3 coordinates

Hierarchy

  • Vector3

Index

Constructors

constructor

  • new Vector3(x?: number, y?: number, z?: number): Vector3
  • new Vector3(point?: Partial<IVec3>): Vector3
  • Parameters

    • Optional x: number

      x value

    • Optional y: number

      y value

    • Optional z: number

      z value

    Returns Vector3

  • Parameters

    • Optional point: Partial<IVec3>

      An object that contains the values x, y and z

    Returns Vector3

Properties

x

x: number = ...

向量的 x 值

The X value of the current vector

default

0

y

y: number = ...

向量的 y 值

The Y value of the current vector

default

0

z

z: number = ...

向量的 z 值

The Z value of the current vector

default

0

Static Readonly MAX

MAX: Vector3 = ...

Vector3 (Infinity, Infinity, Infinity)

Static Readonly MIN

MIN: Vector3 = ...

Vector3 (-Infinity, -Infinity, -Infinity)

Static Readonly ONE

ONE: Vector3 = ...

Vector3 (1, 1, 1)

Static X_DIRECTION

X_DIRECTION: Vector3 = ...

X轴正方向

The positive direction of the X-Axis

Static Y_DIRECTION

Y_DIRECTION: Vector3 = ...

Y轴正方向

The positive direction of the Y-Axis

Static Readonly ZERO

ZERO: Vector3 = ...

Vector3 (0, 0, 0)

Static Z_DIRECTION

Z_DIRECTION: Vector3 = ...

Z轴正方向

The positive direction of the Z-Axis

Accessors

length

  • get length(): number
  • 向量的长度

    Computes length of this vector.

    Returns number

lengthSq

  • get lengthSq(): number
  • 向量长度的平方

    Computes squared length of this vector.

    Returns number

Methods

add

  • 向量加法

    Adds v with the current vector

    Parameters

    • value: number

      a scalar or a Vector3

    Returns Vector3

    A new Vector3

  • Parameters

    Returns Vector3

applyMatrix4

  • 对当前向量应用矩阵

    Apply matrix4 to the current vector

    Parameters

    Returns Vector3

    A new Vector3

clone

  • 复制当前向量

    Clones this vector to a new vector

    Returns Vector3

copy

  • 将向量 v 的值拷贝给当前向量

    Copies v to this vector

    Parameters

    Returns Vector3

cross

  • 叉乘

    Computes cross product of this vector and v

    Parameters

    Returns Vector3

    new Vector

divide

  • 向量除法

    Divides the current vector by v.

    Parameters

    • value: number

      a scalar or a Vector3

    Returns Vector3

    A new Vector3

  • Parameters

    Returns Vector3

dot

  • 点乘

    Computes dot product of this vector and v

    Parameters

    Returns number

equals

  • 两个向量是否相等

    Determines whether this vector and v are equal

    Parameters

    Returns boolean

inverse

  • 逆向量

    Inverse the current vector

    Returns Vector3

    A new Vector3

isOrthogonal

  • isOrthogonal(v: Vector3): boolean
  • 两个向量是否正交垂直

    Determines whether this vector and v are orthogonal

    Parameters

    Returns boolean

isParallel

  • 两个向量是否平行

    Determines whether this vector and v are parallel

    Parameters

    Returns boolean

multiply

  • 向量乘法

    Multiplies the current vector by v.

    Parameters

    • value: number

      a scalar or a Vector3

    Returns Vector3

    A new Vector3

  • Parameters

    Returns Vector3

normalize

  • 单位向量

    Normalizes this vector.

    Returns Vector3

    A new Vector3

set

  • 设置向量的值

    Sets values of the current vector

    Parameters

    • Optional x: number

      x value

    • Optional y: number

      y value

    • Optional z: number

      z value

    Returns Vector3

    当前向量 (this vector3)

  • 设置向量的值

    Sets values of the current vector

    Parameters

    • point: Partial<IVec3>

      An object that contains the values x, y and z

    Returns Vector3

    当前向量 (this vector3)

setX

  • 设置向量的 x 值

    Sets the x value of the current vector

    Parameters

    • x: number

    Returns Vector3

    当前向量 (this vector3)

setY

  • 设置向量的 y 值

    Sets the y value of the current vector

    Parameters

    • y: number

    Returns Vector3

    当前向量 (this vector3)

setZ

  • 设置向量的 z 值

    Sets the z value of the current vector

    Parameters

    • z: number

    Returns Vector3

    当前向量 (this vector3)

sub

  • 向量减法

    Subtracts v from the current vector

    Parameters

    • value: number

      a scalar or a Vector3

    Returns Vector3

    A new Vector3

  • Parameters

    Returns Vector3

Legend

  • Constructor
  • Property
  • Method
  • Static property
  • Static method
  • Property
  • Private property

Generated using TypeDoc