Vector4 四维向量

Struct

Representation of four-dimensional vectors.

表示四维向量。

This structure is used in some places to represent four component vectors (e.g. mesh tangents,  parameters for shaders). In the majority of other cases a Vector3 is used.

这个结构在一些地方用来表示四维向量(例如:网格切线,着色器的参数)。在其他情况下大多数使用Vector3。

Variables变量

  • x
    X component of the vector. //        向量的X组件。
  • y
    Y component of the vector. //        向量的Y组件。
  • z
    Z component of the vector. //        向量的Z组件。
  • w
    W component of the vector. //        向量的W组件。
  • this [int index]
    Access the x, y, z, w components using [0], [1], [2], [3] respectively.
          使用[0], [1],[2],[3]分别访问x, y, z,w组件。
  • normalized
    Returns this vector with a magnitude of 1 (Read Only).
          返回这个向量的长度为1。(只读)
  • magnitude
    Returns the length of this vector (Read Only).
          返回这个向量的长度(只读)。
  • sqrMagnitude
    Returns the squared length of this vector (Read Only).
          返回这个向量的长度的平方(只读)。

Constructors构造器

  • Vector4
    Creates a new vector with given x, y, z, w components.
          创建一个新的具有给定 x, y, z, w 组件的向量。

Functions函数

  • Scale
    Multiplies every component of this vector by the same component of scale.
          由缩放的相同的组件对应乘以这个矢量的每个组件。
  • Normalize
    Makes this vector have a magnitude of 1.
          使向量的长度变为1。
  • ToString
    Returns a nicely formatted string for this vector.
          返回该向量一个格式化好的字符串。

Class Functions类函数

  • zero
    Shorthand for writing Vector4(0,0,0,0) //        写 Vector4(0,0,0,0) 的简码
  • one
    Shorthand for writing Vector4(1,1,1,1) //        写Vector4(1,1,1,1)的简码

Class Functions类函数

  • Lerp
    Linearly interpolates between two vectors. // 两个向量之间的线形插值。
  • MoveTowards
    Moves a point current towards target. //        当前的地点移向目标。
  • Scale
    Multiplies two vectors component-wise. // 两个矢量组件对应相乘。
  • Dot
    Dot Product of two vectors. //        两个向量的点乘积。
  • Project
    Projects a vector onto another vector. //        投影一个向量到另一个向量。
  • Distance
    Returns the distance between a and b. //        返回a和b之间的距离。
  • Min
    Returns a vector that is made from the smallest components of two vectors.
          返回一个由两个向量的最小组件组成的向量。
  • Max
    Returns a vector that is made from the largest components of two vectors.
          返回一个由两个向量的最大组件组成的向量。
  • operator +
    Adds two vectors. //        两个向量相加。
  • operator -
    Subtracts one vector from another. // 一个向量减去另一个向量
  • operator *
    Multiplies a vector by a number. // 一个向量乘以一个数字。
  • operator /
    Divides a vector by a number. //        向量a的每一个组件分别除以d。
  • operator ==
    Returns true if the vectors are equal. //       如果向量是相等的将返回真。
  • operator !=
    Returns true if vectors different. //        如果向量不同将返回真。
  • operator Vector4
    Converts a Vector3 to a Vector4. //        将一个Vector3转化成一个Vector4。
  • operator Vector3
    Converts a Vector4 to a Vector3. //        将一个Vector4转化为一个Vector3。
  • operator Vector4
    Converts a Vector2 to a Vector4. // 转换Vector2到一个Vector4。
  • operator Vector2
    Converts a Vector4 to a Vector2. // 转换一个Vector4到Vector2。
,