Vector4 结构

定义

表示一个具有四个单精度浮点值的向量。Represents a vector with four single-precision floating-point values.

public value class Vector4 : IEquatable<System::Numerics::Vector4>, IFormattable
public struct Vector4 : IEquatable<System.Numerics.Vector4>, IFormattable
type Vector4 = struct
    interface IFormattable
Public Structure Vector4
Implements IEquatable(Of Vector4), IFormattable
继承
Vector4
实现

注解

Vector4 结构为硬件加速提供支持。The Vector4 structure provides support for hardware acceleration.

对于矩阵转换,Vector2Vector3Vector4 实例表示为行:矩阵 M 使用 vM 乘法转换矢量 v 。For matrix transformations, the Vector2, Vector3, and Vector4 instances are represented as rows: a vector v is transformed by a matrix M with vM multiplication.

构造函数

Vector4(Single)

创建一个其四个元素具有相同值的新 Vector4 对象。Creates a new Vector4 object whose four elements have the same value.

Vector4(Single, Single, Single, Single)

创建一个其元素具有指定值的向量。Creates a vector whose elements have the specified values.

Vector4(Vector2, Single, Single)

从指定的 Vector4 对象以及 Z 和 W 分量创建新的 Vector2 对象。Creates a new Vector4 object from the specified Vector2 object and a Z and a W component.

Vector4(Vector3, Single)

从指定的 Vector4 对象以及 W 分量构造新的 Vector3 对象。Constructs a new Vector4 object from the specified Vector3 object and a W component.

字段

W

向量的 W 分量。The W component of the vector.

X

向量的 X 分量。The X component of the vector.

Y

向量的 Y 分量。The Y component of the vector.

Z

向量的 Z 分量。The Z component of the vector.

属性

One

获取一个其 4 个元素等于 1 的向量。Gets a vector whose 4 elements are equal to one.

UnitW

获取向量 (0,0,0,1)。Gets the vector (0,0,0,1).

UnitX

获取向量 (1,0,0,0)。Gets the vector (1,0,0,0).

UnitY

获取向量 (0,1,0,0)。Gets the vector (0,1,0,0).

UnitZ

获取向量 (0,0,1,0)。Gets the vector (0,0,1,0).

Zero

获取一个其 4 个元素等于 0 的向量。Gets a vector whose 4 elements are equal to zero.

方法

Abs(Vector4)

返回一个向量,其元素是指定向量的每个元素的绝对值。Returns a vector whose elements are the absolute values of each of the specified vector's elements.

Add(Vector4, Vector4)

将两个向量相加。Adds two vectors together.

Clamp(Vector4, Vector4, Vector4)

将向量限制在最小值与最大值之间。Restricts a vector between a minimum and a maximum value.

CopyTo(Single[])

将向量的元素复制到指定数组中。Copies the elements of the vector to a specified array.

CopyTo(Single[], Int32)

从指定的索引位置开始,将向量的元素复制到指定的数组中。Copies the elements of the vector to a specified array starting at a specified index position.

Distance(Vector4, Vector4)

计算两个给定点之间的欧几里得距离。Computes the Euclidean distance between the two given points.

DistanceSquared(Vector4, Vector4)

返回两个指定点之间的欧几里得距离平方值。Returns the Euclidean distance squared between two specified points.

Divide(Vector4, Single)

将指定向量除以指定标量值。Divides the specified vector by a specified scalar value.

Divide(Vector4, Vector4)

将第一个向量除以第二个向量。Divides the first vector by the second.

Dot(Vector4, Vector4)

返回两个向量的点积。Returns the dot product of two vectors.

Equals(Object)

返回一个值,该值指示此实例是否与指定对象相等。Returns a value that indicates whether this instance and a specified object are equal.

Equals(Vector4)

返回一个值,该值指示此实例是否与另一个向量相等。Returns a value that indicates whether this instance and another vector are equal.

GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

Length()

返回此向量对象的长度。Returns the length of this vector object.

LengthSquared()

返回向量长度平方值。Returns the length of the vector squared.

Lerp(Vector4, Vector4, Single)

基于给定权重在两个向量之间执行线性内插。Performs a linear interpolation between two vectors based on the given weighting.

Max(Vector4, Vector4)

返回一个向量,其元素是两个指定向量中每对元素的较大值。Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.

Min(Vector4, Vector4)

返回一个向量,其元素是两个指定向量中每对元素的较小值。Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.

Multiply(Single, Vector4)

将标量值乘以指定向量。Multiplies a scalar value by a specified vector.

Multiply(Vector4, Single)

将向量乘以指定标量。Multiplies a vector by a specified scalar.

Multiply(Vector4, Vector4)

返回一个新向量,其值是两个指定向量中的每对元素的乘积。Returns a new vector whose values are the product of each pair of elements in two specified vectors.

Negate(Vector4)

对指定向量求反。Negates a specified vector.

Normalize(Vector4)

返回一个向量,其方向与指定向量相同,但长度为一。Returns a vector with the same direction as the specified vector, but with a length of one.

SquareRoot(Vector4)

返回一个向量,其元素是指定向量的每个元素的平方根。Returns a vector whose elements are the square root of each of a specified vector's elements.

Subtract(Vector4, Vector4)

从第一个向量中减去第二个向量。Subtracts the second vector from the first.

ToString()

使用默认格式设置返回当前实例的字符串表示形式。Returns the string representation of the current instance using default formatting.

ToString(String)

通过使用指定格式字符串设置各个元素的格式,来返回当前实例的字符串表示形式。Returns the string representation of the current instance using the specified format string to format individual elements.

ToString(String, IFormatProvider)

通过使用指定格式字符串设置各个元素的格式并使用指定格式提供程序定义特定于区域性的格式设置,来返回当前实例的字符串表示形式。Returns the string representation of the current instance using the specified format string to format individual elements and the specified format provider to define culture-specific formatting.

Transform(Vector2, Matrix4x4)

通过指定的 4x4 矩阵变换二维向量。Transforms a two-dimensional vector by a specified 4x4 matrix.

Transform(Vector2, Quaternion)

通过指定的四元数旋转值变换二维向量。Transforms a two-dimensional vector by the specified Quaternion rotation value.

Transform(Vector3, Matrix4x4)

通过指定的 4x4 矩阵转换三维向量。Transforms a three-dimensional vector by a specified 4x4 matrix.

Transform(Vector3, Quaternion)

通过指定的四元数旋转值转换三维向量。Transforms a three-dimensional vector by the specified Quaternion rotation value.

Transform(Vector4, Matrix4x4)

通过指定的 4x4 矩阵转换四维向量。Transforms a four-dimensional vector by a specified 4x4 matrix.

Transform(Vector4, Quaternion)

通过指定的四元数旋转值变换四维向量。Transforms a four-dimensional vector by the specified Quaternion rotation value.

运算符

Addition(Vector4, Vector4)

将两个向量相加。Adds two vectors together.

Division(Vector4, Single)

将指定向量除以指定标量值。Divides the specified vector by a specified scalar value.

Division(Vector4, Vector4)

将第一个向量除以第二个向量。Divides the first vector by the second.

Equality(Vector4, Vector4)

返回一个值,该值指示两个指定向量中的每对元素是否相等。Returns a value that indicates whether each pair of elements in two specified vectors is equal.

Inequality(Vector4, Vector4)

返回一个值,该值指示两个指定向量是否不相等。Returns a value that indicates whether two specified vectors are not equal.

Multiply(Single, Vector4)

将标量值乘以指定向量。Multiples the scalar value by the specified vector.

Multiply(Vector4, Single)

将指定向量乘以指定标量值。Multiples the specified vector by the specified scalar value.

Multiply(Vector4, Vector4)

返回一个新向量,其值是两个指定向量中的每对元素的乘积。Returns a new vector whose values are the product of each pair of elements in two specified vectors.

Subtraction(Vector4, Vector4)

从第一个向量中减去第二个向量。Subtracts the second vector from the first.

UnaryNegation(Vector4)

对指定向量求反。Negates the specified vector.

适用于